Compiling/generate 32-bit version of a program on x86-64
Gilboa Davara
gilboad at gmail.com
Sat Jan 28 15:35:49 UTC 2006
On Sat, 2006-01-28 at 10:14 -0500, Reuben D. Budiardja wrote:
> Hello,
> My platform is AMD-64 running Fedora 4 64-bit version. Is there a way for me
> to compile and generate 32-bit version of a program ( in C )? How does one do
> that using GCC ? Since 64-bit version also install all the 32-bit
> compatibility library, that should not be a problem, is it ?
>
> One of the reasons I want to do this because I have an object file ( .o ) that
> I need to link againts, but the object file is in 32-bit, and I don't have
> the source to regenerate the object file. During linking, ld generates
> warning :
> /usr/bin/ld: warning: i386 architecture of input file `api/render.o' is
> incompatible with i386:x86-64 output
>
> and the program will segfaults if run, which does not happen if I compiled the
> program in 32-bit machine. But since my working desktop is 64-bit, I am
> wondering if there's a way for me to do it without having to look for 32-bit
> machine.
>
> Thanks for any help.
> RDB
> --
> Reuben D. Budiardja
> Dept. Physics and Astronomy
> University of Tennessee, Knoxville, TN
>
Either add "ARCH=i386" before the ./configure line or add the "-m32"
switch to gcc.
Gilboa
More information about the fedora-list
mailing list