Compiling on a 64 bit Linux

I’m currently in the process of upgrading my old server to a nice new 64 bit CentOS 5 install and came across a few issues rebuilding some of the packages.
In general I try not to use customised versions of packages since it makes updating the machine so much easier when there’s nothing to rebuild, however some things I do customise slightly such as Apache and Exim.
Whilst rebuilding the Exim RPM I came across some strange errors which I assumed (correctly) were to do with the fact that it was a 64 bit OS not 32 bit.

The error message was that it was skipping an incompatible library
gcc -o eximon.bin
/usr/bin/ld: skipping incompatible /usr/lib/ when searching for -lXt
/usr/bin/ld: cannot find -lXt
collect2: ld returned 1 exit status
make[1]: *** [eximon.bin] Error 1
I had a quick look at the RPMs that were already installed for libXt with a “yum list libXt” command. It told me that both 32 and 64 bit versions were installed.
libXt.x86_64 1.0.2-3.1.fc6 installed
libXt.i386 1.0.2-3.1.fc6 installed
Puzzled, I went off to consult Google and found plenty of similar problems, but no solutions. After several attempts to compile it manually within the BUILD directory, I got the same error, but with a different library. Finally I figured out that although both 32 and 64 bit versions of libXt were installed, only the 32 bit version of libXt-devel was installed.
yum install libXt-devel
It’ll then prompt to install the x86_64 version even though the i386 version is already installed. Repeat for any other incompatible library errors. Usually both 32 and 64 bit library packages are installed, but only the 32 bit version of the corresponding -devel package.
Just 8 -devel package installs later and rpmbuild successfully rebuilt the Exim RPM with no errors.
To find out what’s installed:
yum list libXt\*
All being well you should have two pairs of packages installed – libXt-devel and libXt, both i386 and x86_64. Obviously you can substitute libXt for whatever libraries are causing problems.