g++ -m32 can not find libstdc++ on debian amd64 - c++

I got the following error when compiling a simple hello world program on debian amd64 wheezy(testing) with g++ -m32:
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
I don't have any problems with gcc -m32. I also installed lib32stdc++ package, but it does not seem to work. Thanks.

Pretty sure you need to install g++-4.6-multilib (it would appear you already have gcc-4.6-multilib).

Try installing ia32-libs-dev package.

Related

installation & compilation boost on Manjaro

I installed boost using pacman -S boost boost-libs.
When I try to compile a program that uses boost::thread, and I got the following error:
/usr/bin/ld: /tmp/cc3AkelG.o: warning: relocation against `_ZTVN5boost6detail16thread_data_baseE' in read-only section `.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
Why does this happen and how can I fix it?
I find the answer in an other question.
I had to compile using -pthread -lboost_thread.
thanks for your answer.

libGL does exists, but linker can't find it - Qt 4.8.7, CentOS 7.5

I have CentOS Linux release 7.5.1804 with Qt 4.8.7 installed from base repo. I installed NVidia driver version 390.59 release date 2018.5.16.
I have libGL-mesa and libGL-mesa-devel INSTALLED also.
My graphics card Quadro K4000M is doing just fine - for example, glxgears 60fps, Qt Demos (OpenGL) work.
But when I am trying to compile the chip example, I am getting the following error:
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible //lib/libGL.so when searching for -lGL
/usr/bin/ld: skipping incompatible //usr/lib/libGL.so when searching for -lGL
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [chip] Error 1
Here is the ls command output:
[user#centos-7 ~]$ ls -h /usr/lib64/ | grep "libGL"
libGLdispatch.so.0
libGLESv1_CM_nvidia.so.1
libGLESv1_CM_nvidia.so.390.59
libGLESv1_CM.so
libGLESv1_CM.so.1
libGLESv1_CM.so.1.2.0
libGLESv2_nvidia.so.2
libGLESv2_nvidia.so.390.59
libGLESv2.so
libGLESv2.so.2
libGLESv2.so.2.1.0
libGL.la
libGL.so
libGL.so.1
libGL.so.1.7.0
libGLU.so
libGLU.so.1
libGLU.so.1.3.1
libGLX_indirect.so.0
libGLX_nvidia.so.0
libGLX_nvidia.so.390.59
libGLX.so
libGLX.so.0
How to solve the problem?
The problem is solved - I install NVIDIA the latest driver (version: 390.67 release Date: 2018.6.5) in this way: http://www.advancedclustering.com/act_kb/installing-nvidia-drivers-rhel-centos-7/.

linking things in c++ using object file

PROBLEM SOLVED:::
I am using LEDA library in c++.
command used to make object file.
g++ -I$LEDAROOT/incl -c mult.cpp
this command runs fine
I am getting eroor while linking step.
HERE IS THE EROOR
varun#Kinley:~/Documents/LEDA/test/numbers$ g++ -L$LEDAROOT mult.o -lleda -lX11 -lm
/usr/bin/ld: cannot find -lX11
collect2: error: ld returned 1 exit status
I think I need to install some package,because when I googled this error the most of problems are solved by installing some package .
I didn't find lx11 error
some of the eroor messages that I googled.
error 1
/usr/bin/ld: cannot find -lfreetype collect2: ld returned 1 exit
status
error 2
/usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status
Links where I find these posts
http://www.qtcentre.org/threads/21069-collect2-ld-returned-1-exit-status
http://www.cyberciti.biz/faq/centos-rhel-redhat-usrbinld-cannot-findlc-error/
Do I need to install some package or there is some other problem
Could be two things
1) The X11 library is installed in a non-standard path. Use the search command to see if libX11.a or libX11.so is available on your system. If yes add the directory path to the -L option.
2) You are missing the libX11 library.
In this case, login as admin and use yum (assuming linux) to install this library.
Eg:
"yum install libX11.i386" or "yum install libX11.x86_64", depending on your architecture (32 bit or 64 bit).

Cannot find lffi - Error linking with llvm libraries

I am trying to use LLVM as backend for my compiler, and while linking with the llvm libraries, I get this error
g++ obj/*.o `llvm-config --ldflags core jit native` `llvm-config --libs core jit native` -lfl -o Icarus
/usr/bin/ld: cannot find -lffi
collect2: ld returned 1 exit status
I have installed llvm on my system and my cpp files compile fine. Its during linking that the library its searching can't be found.
If on a deb system try installing the dev libs, they solved the problem for me:
sudo apt-get install libffi-dev
Hmm. Did you install libffi too?
ftp://sourceware.org/pub/libffi/libffi-3.0.10.tar.gz
I know that installing libffi into /usr prefix helped me, when ld complained about being unable to find -ffi

libstdc++ 64bit and 32bit version on the same machine

I am trying to cross compile a version of my software for a 64bit platform. Can I have the 32bit and 64bit version of libstdc++ installed on the same machine without too much worries of breaking my linux install. The Os is 32bit ubuntu.
I have not cross compiled before and just wanted to check that if I set my CFLAGS and LDFLAGS
for the appropriate CPU I should be ok once I have the correct versions of libstdc++ installed.
I checked a 64bit version of ubuntu however this has a symbolic link
lib64 -> lib
this would mess up lots if this is the case on a 32bit machine too anyone know how to sort this?
I am hitting the following error at the moment
[exec] /usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.2.4/libstdc++.so
[exec] /usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.2.4/libstdc++.a
when searching for -lstdc++ [exec] /usr/bin/ld: skipping incompatible
and so on till
[exec] /usr/bin/ld: cannot find -lstdc++
[exec] collect2: ld returned 1 exit status
Which seems to be due to fact I do not have the 64bit version of libstdc++
Sure you can.
Just put them into /usr/lib and /usr/lib64, respectively.
Can't check it on Ubuntu, but on Fedora they get there right from the packages:
[~#] repoquery -q -l libstdc++.i386
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.10
[~#] repoquery -q -l libstdc++.x86_64
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.10