32-bit Compiling and Linking

Jeremy Dreese <[email protected]> Thu, 13 Jul 2006 10:29:08 -0400
Newsgroups gmane.linux.redhat.amd64
Message-ID <[email protected]>
We have user home directories that are shared across 32-bit and 64-bit
systems.  We have setup a wrapper script around gcc/g++ so that our
64-bit systems compile in 32-bit mode by default; basically, the "-m32"
option is just inserted into a user's gcc/g++ command.  This works fine
if the user is not linking against a library (e.g. "gcc -o hello
hello.c").  However, if they need to link against a library, they get an
error like this:

[user@host dir]$ gcc -o sslnumbers -lssl sslnumbers.c
/usr/bin/ld: skipping incompatible /usr/lib64/libssl.so when searching
for -lssl/usr/bin/ld: skipping incompatible /usr/lib64/libssl.a when
searching for -lssl
/usr/bin/ld: cannot find -lssl
collect2: ld returned 1 exit status

Obviously, it cannot find the 32-bit version of the "ssl" library.  This
occurs because their in fact is no "/usr/lib/libssl.so", although
"/usr/lib/libssl3.so" *does* exist.  Further, as far as I know there is
no package that includes the necessary "/usr/lib/libssl.so" link.  Is
there a way to have the linker find the necessary 32-bit library (other
than manually creating a link)?

Thanks,
Jeremy Dreese