PhuongLM
PhuongLM

Reputation: 91

library stdc++ is not found

I'm trying to compile Boomerang compiler in Ubuntu 16.06. I installed gcc and g++ ver 4.8, I also got g++-4.8-multilib. When I run

./configure --host=i686-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"

It display an error

checking for main in -lstdc++... no configure: error: library stdc++ is not found...

When I ran this command

/sbin/ldconfig -p | grep stdc++

I got

 libstdc++.so.6 (libc6,x32) => /usr/libx32/libstdc++.so.6
    libstdc++.so.6 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    libstdc++.so.6 (libc6) => /usr/lib/i386-linux-gnu/libstdc++.so.6
    libstdc++.so.6 (libc6) => /usr/lib32/libstdc++.so.6

I thought this error happened because I don't have libstdc++.so.6 in my /usr/lib. And the configure didn't look for other places. But I don't know how to fix it.

This is a part of the config.log file, hope it helps.

configure:3228: checking if using GNU ld 
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.3.1-14ubuntu2.1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1) 
GNU ld (GNU Binutils for Ubuntu) 2.26
configure:3245: result: yes 
configure:3248: checking if host is Windows 
configure:3258: result: no 
configure:3261: checking if host is Cygwin 
configure:3271: result: no 
configure:3274: checking if host is OS X 
configure:3294: result: no 
configure:3297: checking if host is OS X 10.2 
configure:3317: result: no 
configure:3326: checking for main in -lstdc++
configure:3350: gcc -o conftest -m32 -Wall  -m32 conftest.c -lstdc++   >&5
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++

I'm a newbie with Linux and programs written in C and C++ like this, please help me. Thank you!

Upvotes: 0

Views: 6937

Answers (1)

Mike Kinghan
Mike Kinghan

Reputation: 61575

As you are evidently aware you need to install the multilib support for your gcc/g++ compiler(s) to build 32-bit binaries on your 64-bit host. However, you have installed multilib support for g++-4.8 while, according to your config log, you are building with gcc/g++ 5.3.1, for which you have no multilib support.

I do not know why you might want to use 4.8, but either build with 4.8, not 5.3.1, or else install multilib support for 5.3.1 and then build with 5.3.1.

If you have both compilers installed you can specifically invoke the one you want like:

$ gcc-4.8 ...
$ g++-5 ...

Similarly if you wish to specify a specific compiler version to a configure script then do so like:

./configure CC=gcc-4.8 CXX=g++-4.8 ...

BTW, boomerang is not a compiler, it is decompiler.

Upvotes: 0

Related Questions