PDA

View Full Version : [ubuntu] Compiling C++ program for i386 architecture


Stargazer712
May 2nd, 2008, 04:56 PM
Ok, I am trying to compile a very simple c++ program using g++. The computer that I am compiling it on is using an x86_64 architecture, and the computer it will be run on is using an i386 architecture.

I need to be able to compile the program on my computer (x86_64) and run it on the i386 computer. Are there any options on g++ that will allow me to compile for a different architecture?

thanks in advance.

Grishka
May 2nd, 2008, 05:20 PM
I believe it needs the "-m32" option. also, you'll probably need 32-bit libraries for that.

vishalrao
May 3rd, 2008, 09:18 AM
see if installing packages like ia32-libs, linux32 and gcc-multilib helps.
do "aptitude search lib32" for more stuff you might want.

i have done it and needed to include "/usr/lib32" in a conf file in /etc/ld.so.conf.d/ and also made a symlink "ln -s /usr/lib32/libstdc++.so.6.0.9 /usr/lib32/libstdc++.so" - you can point to the .5 version if you need...

HTH