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

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

Related

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/.

building 32 exe on 64 bit open suse linux gives link error

In my VM, I have installed open suse linux 64 bit.
Trying to build an exe for 32 bit.
But on running the command :
g++ prg1.cpp -o prg1 -m32
I get the following error:
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible
/usr/lib64/gcc/x86_64-suse-linux/4.8/libstdc++.so when searching for
-lstdc++ /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible /usr/lib64/gcc/x86_64-suse-linux/4.8/libstdc++.a
when searching for -lstdc++
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
cannot find -lstdc++ collect2: error: ld returned 1 exit status
To build for 32 i have installed the necessary rpms for 32 bit.
On running
g++ -print-search-dirs , the output is
install: /usr/lib64/gcc/x86_64-suse-linux/4.8/ programs:
=/usr/lib64/gcc/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/:/usr/lib64/gcc/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/
libraries:
=/usr/lib64/gcc/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib/x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib/../lib64/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../x86_64-suse-linux/4.8/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/:/lib/x86_64-suse-linux/4.8/:/lib/../lib64/:/usr/lib/x86_64-suse-linux/4.8/:/usr/lib/../lib64/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib/:/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../:/lib/:/usr/lib/
Although the 32 bit libstdc++ is also installed, the linker is not able to link to it. Is any specific flag required to tell the linker to build 32 bit
Or I have to install any other package?
To build for 32 i have installed the necessary rpms for 32 bit.
No, you have not.
Note that in order to build programs you need 32-bit runtime and development libraries. I am guessing that you've installed the former, but not the latter.

Missing libAnalyzer

I am trying to build the analyzer using the Saleae SDK 1.1.19 but run into an error when running the python script. Not sure if it is because I am running a 64bit version of Ubuntu. I also could not find the ./lib/libAnalyzer.so
link to the analyzer that I am using
https://www.saleae.com/index
Error:
/usr/bin/ld: skipping incompatible ../lib/libAnalyzer.so when searching for -lAnalyzer
/usr/bin/ld: cannot find -lAnalyzer
collect2: ld returned 1 exit status
g++ L"../lib" -lAnalyzer -shared -o"debug/libNSLogicAnalyzer.so" debug/NSLogicAnalyzer.o debug/NSLogicAnalyzerSettings.o debug/NSLogicAnalyzerResults.o
System information:
Ubuntu 12.04LTS 64bit,
Python 2.7.3
thanks!
LC
Ah figured it out, it was calling the 32bit libAnalyzer.so in the lib folder. I just renamed the 64 bit to the same name as the 32bit (renamed the 32bit to something else so it would not create the error again)

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

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

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.