blog.plee.me About software, technology and random things

26Jun/090

Compiling Exim and MySQL on a (CentOS) 64 bit Environment

Hey there!

I was recently trying to compile Exim with MySQL support on a CentOS 5.x 64 bit system. However, I had my dear share of trouble when it came to adjust the Local/Makefile for the 64 bit architecture.

The following error was what I got stuck on:

...
gcc dkim-exim.c

awk '{ print ($1+1) }' cnumber.h > cnumber.temp
rm -f cnumber.h; mv cnumber.temp cnumber.h
gcc version.c
rm -f exim
gcc -o exim
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make[1]: *** [exim] Error 1
make[1]: Leaving directory `/root/incoming/exim-4.69/build-Linux-x86_64'
make: *** [go] Error 2

Turns out it was easier to solve than I thought. The point was that it was looking for 32 bit libraries where it should have been looking for 64 bit ones. I adjusted the following lines in Local/Makefile:

LOOKUP_INCLUDE=-I /usr/include/mysql
LOOKUP_LIBS=-L/usr/lib/mysql -lmysqlclient -lz -lm

to say this:

LOOKUP_INCLUDE=-I /usr/include/mysql
LOOKUP_LIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm

And - hurray! - it works 🙂

Be careful though, it seems to need the /mysql after /usr/lib64.