I want to use c++14 features so I wanted to use the GCC 6.3 compiler.
I've done the list of commands found here
Afterwards, I created a new kit, and used the newly installed xg++ compiler here's the compiler description and added the following in my .pro CONFIG += c++11 c++14
Still the compiler doesn't recognize strings/cout/endl and can't use auto for automatic return type deduction. Also, the binary literals are not recognized.
what I am missing here?
It turns out that it's a bug in Qt Creator not switching to use the given compiler by providing its path in the kit. However, I executed the following steps from terminal:
// Update & Build Essentials & add ppa of the gcc & update again
$ sudo apt-get update
$ sudo apt-get install build-essential software-properties-common -y
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y // ppa of gcc 6.3
$ sudo apt-get update
$ sudo apt-get install gcc-snapshot -y
$ sudo apt-get update
// Install the gcc and Add the gcc as an alternative
$ sudo apt-get install gcc-6 g++-6 -y
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
// You can switch the gcc verions via
$ sudo update-alternatives --config gcc
and made an alternative to my existing GCC. Once I restored the default kit of Qt creator and set the default GCC to 6.3 instead of 4.8, I was able to run C++14 features with ease provided that
CONFIG += c++14 is in the .pro.
Related
I need to install this specific python version, to prepare a developer environment, because I'm maintaining a system with multiple libraries based on python 3.6.9.
I recently installed Ubuntu 22.04 on my laptop, but I had no success trying to install this python version.
I tried to install with apt-get after adding the deadsneak repository, but this python version is not available.
I tried installing from source by compiling, but it did not work. Running sudo make altinstall exited with this error:
Segmentation fault (core dumped)
make: *** [Makefile:1112: altinstall] Erro 139
I have faced the same problems and could make it work by adding some additional flags when running ./configure
Here are my steps:
Step 1 – Prerequsities
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev \
libgdbm-dev libnss3-dev libedit-dev libc6-dev
Step 2 – Download Python 3.6
wget https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tgz
tar -xzf Python-3.6.15.tgz
Step 3 – Compile Python Source
cd Python-3.6.15
./configure --enable-optimizations -with-lto --with-pydebug
make -j 8 # adjust for number of your CPU cores
sudo make altinstall
Step 4 – Check the Python Version
python3.6 -V
If you need it to install with pyenv, you could try this one:
$ sudo apt install clang -y
$ CC=clang pyenv install 3.6.9
I want to study sqlite by reading its source code. I found sqlite-1.0.1 only contained 10,000+ lines code, maybe it is easy to read. But unfortunately, modern gcc cannot compile sqlite-1.0.1.
wget "https://www.sqlite.org/src/tarball/e8521fc1/SQLite-e8521fc1.tar.gz"
tar xzvf SQLite-e8521fc1.tar.gz
mkdir bld && cd bld
../SQLite-e8521fc1/configure --prefix=/opt/sqlite-1.0.1 --with-tcl=no
make
When I issued make, it reported
gcc -std=c89 -g -O2 -o lemon ../SQLite-e8521fc1/tool/lemon.c
In file included from ../SQLite-e8521fc1/tool/lemon.c:29:
/usr/lib/gcc/i386-redhat-linux/3.4.2/include/varargs.h:4:2: #error "GCC no longer implements <varargs.h>."
/usr/lib/gcc/i386-redhat-linux/3.4.2/include/varargs.h:5:2: #error "Revise your code to use <stdarg.h>."
I tried appending -std=c89 following gcc in Makefile, but it did not work.
I specially installed a old Fedora Core release 3 virtual machine to compile SQLite-1.0.1, but it looks like the gcc(gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)) within Fedora 3 is still too modern for the 18 years ago code.
I found a check in which <varargs.h> was replaced by <stdarg.h>, and the author said maybe he has used gcc to compile lemon.c in 1989.
Maybe a very old gcc or Linux (before 2000) can solve this problem, but how can I get that one?
I have modified the code of sqlite 1.0.1 and can now compile and run successfully on fedora 36 & MacOS 12.3. You can find this code on github. It can be compiled in docker as follows.(Note: You can also use gcc instead of clang)
docker pull fedora:36
docker run -dt --name f36 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined fedora:36
docker exec -it f36 bash
dnf update -y
dnf install -y ncurses git hostname clang diffutils readline-devel tcl-devel gdbm-devel
mkdir ~/src && cd ~/src
git clone https://github.com/ruomeng0x/sqlite.git
cd ~/src/sqlite
git checkout badcc1d968fdb7cf0ff5d89468248468b8329f4e
mkdir ../build && cd ../build
CC=clang CFLAGS="-std=c89" bash ../sqlite/configure
make
I have problem in newest ns-3.26 with nsc-0.5.3 and gccxml-ns3 - system is very up-to-date so that's not the case.
Building nsc-0.5.3 - Problem
Problem: Optional dependency, module "nsc-0.5.3" failed
This may reduce the functionality of the final build. However, bake will continue since "nsc-0.5.3" is not an essential dependency. For more information call bake with -v or -vvv, for full verbose mode.
Found the solution - NSC doesn't work properly with gcc/g++-6 so I had to change default version of gcc and g++ (for example from 6.3.0 to 5.4.1)
1) Find installed compilers:
dpkg --list | grep compiler
2) Change default gcc, g++, cc and c++ (via https://askubuntu.com/questions/26498/choose-gcc-and-g-version):
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
Also, to check if changes are saved:
gcc -v
It should say: "gcc version 5.4.1" at the end.
After that, NSC was installed successfully.
It's worth mentioning that it didn't fix gccxml's problem, but in my case I needed NSC working so...
I followed the following steps given on the OpenWrt website to setup the OpenWrt build system.
sudo apt-get update
sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev
git clone https://github.com/openwrt/openwrt.git
git clone -b chaos_calmer git://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
I made the necessary changes in the configuration file and ran the make command. It gives the following error: make: *** [world] Error 1
Any solutions?
use following command options to know the exact error you are getting
make -j1 V=s
Sometimes due to slow internet speed(while fetching package source code for openwrt) or due to less RAM availability or wrong configuration leads to this error. Post the error message block you are getting, to understand more about the problem.
Please, follow up the following prerequisities:
https://wiki.openwrt.org/doc/howto/buildroot.exigence
Take a look especially at the table "Table of known prerequisites and their corresponding packages".
You have to install version7 of gcc and g++ so Try this:
sudo apt install gcc-7 g++-7 build-essential
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
I installed QtCreator on an Odroid but it seems to be missing a compiler. I tried the following terminal commands but it did not solve the problem.
sudo apt-get install g++
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
How can set GCC as the compiler in QtCreator ? Thanks in advance.
Define a compiler in Tools>Options>Build & Run>Compilers, then switch to the kits tab and add that compiler to the kit you want to use.
The process is described in detail in the manual:
https://doc.qt.io/qtcreator/creator-tool-chains.html for the compiler setup and https://doc.qt.io/qtcreator/creator-targets.html is about the kits.