PDA

View Full Version : 32bit compilation on 64bit machine?


angoyal
10-14-2005, 06:10 AM
why won't my bloody 32bit compilation work on a 64bit box?

$ cat hello32.c
#include <stdio.h>

int
main()
{
printf("Hello\n");
return 0;
}

$ gcc -m32 hello32.c -lc
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status

$ gcc -m32 hello32.c
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status

$ uname -a
Linux xxx 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:29:47 EST 2005 x86_64 x86_64 x86_64 GNU/Linux


$ gcc -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.3/specs
Configured with: ../configure --prefix=/usr
--mandir=/usr/share/man
--infodir=/usr/share/info
--enable-shared
--enable-threads=posix
--disable-checking
--with-system-zlib
--enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,java,f77
--enable-java-awt=gtk
--host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)

i3839
10-14-2005, 12:10 PM
Check that LD_LIBRARY_PATH has the 32 bit libraries before the 64 bit ones so that the thing is linked with the correct libs, and that those libs can be found at all.

How mixed 32 and 64 bit libraries and programs are handled is distribution specific, so best to ask help with this by your distro's help sources.