compiling a C++ program using g++ with x86 settings on x86_64
Hi All,
How can I compile a C++ application using g++ with x86 platform settings on a x86_64 machine ? What are the possible negative side-effects of compiling a C++ application with x86 settings on a x86_64 platform ? I am using 64-bit Ubuntu 9.10. Thanks. |
from man gcc:
These -m switches are supported in addition to the above on AMD x86-64 processors in 64-bit environments. -m32 -m64 Generate code for a 32-bit or 64-bit environment. The 32-bit environment sets int, long and pointer to 32 bits and generates code that runs on any i386 system. The 64-bit environment sets int to 32 bits and long and pointer to 64 bits and generates code for AMD's x86-64 architecture. For darwin only the -m64 option turns off the -fno-pic and -mdynamic-no-pic options. |
Quote:
|
Unless you are looking for a portable binary, one that will work on 32 bit machines, I wouldn't bother.
Please note, that when you compile a 32 bit target, you need the 32bit versions of any libraries installed as well. |
Quote:
If that is the case, the list of all libraries to be compiled as 32-bit may get too long to handle ... |
Quote:
|
BTW, you can't really make any mistakes by mixing 32-bit applications with 64-bit libraries. The linker (ld) will make sure, that this doesn't happen. If you try to do that, the linker will complain :) usually because of mismatching ABI ...
- Andi - |
All times are GMT -5. The time now is 04:38 PM. |