I ve already read the other topics that talk about this subject but it does not help me..
My problem : i can't compile my program for 32bit on a debian which is 64bit
I am using Eclipse c++ btw
I saw Axel Mueller say :
To build 32Bit applications on a 64Bit platform you need:
- gcc/g++ with multilib
- ia32-libs (needed to link and run your application)
- in Eclipse you add -m32 to the compiler and linker flags
I did not have g++-multilib so I installed it by apt-get install g++-multilib. But i dont know if eclipse use the new or the older g++.
I hadnt got ia32-libs either so I did apt-get ia32-libs too.
But i dont know how to use it..
And Ive read on the internet that the option -m32 in project/properties/c/c++build/settings/GCC C++ Compiler/Command should work
But even though I tried it, I cannot make it work.
First, I dont understand how the lib ia32 will be linked to my application if i dont add it in project properties/c++ linker/librairies..
Second, i am working on Debian 64 bit and using the graphic librairy "Foxtool kit" so I install it like this (./configure make make install) but it is compiled for 64bit system so when I compile my application that needs Fox lib (g++ -m32 -L/root/Documents/lib/64bit -o"testfox" ./NotreWindow.o ./main.o -lFOX-1.6) the error message is :
/usr/bin/ld: skipping incompatible /root/Documents/lib/64bit/libFOX-1.6.so when searching for -lFOX-1.6
/usr/bin/ld: skipping incompatible /root/Documents/lib/64bit/libFOX-1.6.a when searching for -lFOX-1.6
/usr/bin/ld: skipping incompatible /usr/local/lib/libFOX-1.6.so when searching for -lFOX-1.6
/usr/bin/ld: skipping incompatible /usr/local/lib/libFOX-1.6.a when searching for -lFOX-1.6
/usr/bin/ld: cannot find -lFOX-1.6
I have compiled Fox in Debian 32bit as well and I import it in my Debian 64bit and I try this :
g++ -m32 -L/root/Documents/lib/32bit -o"testfox" ./NotreWindow.o ./main.o -lFOX-1.6
The error message is :
FXFont.cpp:(.text+0x1clibFOX-1.6.a(FXFont.o): In function `FX::FXFont::getCharWf6): undefined reference to `XftTextExtents32'
(999999 errors like that)
The compiler does not recognize anything in the lib..
I dont know how to do it.
Firstly, you have to compile Foxtool kit library as 32bit version on your 64bit host. Have a look at the configure options to see how you can pass gcc compiler flags http://stackoverflow.com/questions/3261909/build-32bit-on-64-bit-linux-using-a-configure-script
When I compile FOX (64 bit standard) it works, I can create an application that uses FOX, perfect.
But, when I add -m32 to complile FOX, the error message appears :
skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libGLU.so when searching for -lGLU
I know FOX uses GLU library and i have it in my system but in 64bit version!
It is always the same problem :
I tried to compile my application in 32bit, but I could not because I have FOX in 64bit.
And now I am trying to compile FOX in 32bit, but I cannot because I have GLU in 64bit..
I have figured out how it works so when i compile FOX in 64bit it works.
But when i want to compile in 32bit the error message appears :
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libXft.so when searching for -lXft
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libXft.a when searching for -lXft
/usr/bin/ld: skipping incompatible /usr/lib/libXft.so when searching for -lXft
/usr/bin/ld: skipping incompatible /usr/lib/libXft.a when searching for -lXft
/usr/bin/ld: cannot find -lXft
I dont understand why, because in FOX properties/C++build/settings/C++linker/libraries/ I change the path to : /usr/lib32/ (libs given by package ia32-libs)
root@solinnen:~# ls /usr/lib32/libXft.so.2
I dont understand why it tries to link libXft from /usr/lib/libXft.so !
But i do not understand, if someone can explain to me?
Now how can i do this compilation in Eclipse?
In this case you explicitly name the Xft library to use for linking (remember: -L is usually for the library path). You can user this approach in Eclipse, too. You have to tweak the settings C/C++ Build->Settings->Linker settings
It works. I add /usr/lib32/ in FOX properties/C++build/settings/C++linker/libraries/library search path(-L) but i can not add /usr/lib32/libXft.so.2 in FOX properties/C++build/settings/C++linker/libraries/libraries(-l).
So i add it in FOX properties/C++build/settings/C++linker/Miscellaneous/other object
I find it dirty but it works.
Now i export my 32but application on my 32bit Debian:
./exe: error while loading shared libraries: libFOX.so: cannot open shared object file: No such file or directory.
Fox is a shared library because only with shared librares you have the option C++linker in properies if not how link others libraries (-lX11, -lXft, -lGLU) to a static library?