I'm using autotools to build my system, which consists primarily of a library. On 64-bit Red Hat platforms, I need to be able to produce a library capable of working on 32-bit Red Hat platforms.
When I add -m32
to the compile lines everything works fine to produce a static (.a
) library, but as soon as I try to create a shared-library, I get error like this:
/usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbeginS.o' is incompatible with i386 output
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbeginS.o: In function `__do_global_dtors_aux':
crtstuff.c:(.text+0x29): undefined reference to `__DTOR_END__'
collect2: ld returned 1 exit status'
I can see the problem is that it's including 64-bit object files out of /usr/lib64 instead of the correct 32-bit ones out of /usr/lib (they're there alright), but I can't figure out how to fix it.