I have multiple version of c++ compilers installed on my laptop. I am trying to build my code using g++-9.3 with a 32-bit compiler. So I tried to install the multilib
by using
sudo apt-get install gcc-multilib g++-multilib
and also tried to install the following packages
sudo apt install g++-9-multilib sudo apt install gcc-9-multilib
However, the result is
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++-multilib is already the newest version (4:7.4.0-1ubuntu2.3).
gcc-multilib is already the newest version (4:7.4.0-1ubuntu2.3).
0 upgraded, 0 newly installed, 0 to remove and 83 not upgraded.
The current activated gcc is
sudo update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-9 60 auto mode
1 /usr/bin/gcc-6 40 manual mode
2 /usr/bin/gcc-7 50 manual mode
3 /usr/bin/gcc-9 60 manual mode
Press <enter> to keep the current choice[*], or type selection number:
> sudo update-alternatives --config g++
There are 3 choices for the alternative g++ (providing /usr/bin/g++).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/g++-9 60 auto mode
1 /usr/bin/g++-6 40 manual mode
2 /usr/bin/g++-7 50 manual mode
3 /usr/bin/g++-9 60 manual mode
> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-11ubuntu0~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-11ubuntu0~18.04.1)
The gcc still trying to build the code in 64-bit fashion which generating compile error
/usr/include/c++/9/bits/random.h:103:26: error: expected unqualified-id before ‘__int128’
103 | { typedef unsigned __int128 type; };
|
What do I need to do to let apt
installing the multlib
for g++9.3.0 to be able to compile 32-bit codebase?
My bad, I had the following settings in the make file
-I/usr/include/x86_64-linux-gnu/c++/9
The compiler works as expected after I remove the include path