There are days when working with technology feels like getting your fingers caught in a closing car door. Yesterday was one of those days.
The goal seemed simple: re-compile PHP on a 64-bit CentOS 5.1 Linux host to add support for IMAP. This blog post shows exactly how simple it was[n’t].
As a rule, I like to compile my development tools from source. This allows me to standardize on a particular version of the tool and not be tied to the version available in the Linux distribution. Additionally, it lets me run multiple versions of a tool side-by-side (with the help of our BundleWorks product). For system-level libraries, I prefer to install them using the packaging system provided with the OS (apt-get, yum/rpm, etc.).
Anyway, I had already built Apache, MySQL, and PHP from source, when I discovered that I needed IMAP support in PHP. According to the PHP website, I needed to install the c-client IMAP library first.
Since I was running CentOS, I used
yum install libc-client-devel libc-client
to install the c-client library and the necessary headers. I then added –with-imap to the list of configure options.
This resulted in the following configure error:
This c-client library is built with Kerberos support.
Add --with-kerberos to your configure line. Check config.log for details
Fair enough. I added –with-kerberos to the configure command line.
This resulted in a new error:
error: Kerberos libraries not found.
Check the path given to --with-kerberos (if no path is given, searches in /usr/kerberos, /usr/local and /usr )
I checked my system, and found that the Kerberos libraries were installed in /usr/lib64. So I passed –with-kerberos=/usr/lib64 to the configure script, but the script still reported that the Kerberos libraries could not be found.
So I “googled the error message”, like any good programmer would do. After trying a couple of suggestions without any luck, I decided to do something which has helped me diagnose compile errors in the past:
sh -x ./configure ...configure options...
This provides debugging output for the configure script, by using the -x switch for the sh command (the configure script is shell script, after all). It also provides more useful information than you would normally find in the config.log file.
From the pages of output that filled my terminal, I found that the configure script was appending “lib” to the –with-kerberos path that I provided, so it was looking inside a non-existent “/usr/lib64/lib” directory. However, I found that I could change “lib” to “lib64″ by passing –with-libdir=lib64 to the configure script. Victory seemed imminent.
It was not imminent enough. The configure script now complained that it couldn’t find the MySQL client libraries in the location that I previously installed them. It was using this libdir value of “lib64″ to look inside the MySQL installation, and the libraries instead were in a directory named “lib”. Exasperated, I ended up creating a softlink named “lib64″ inside the MySQL installation to point to the “lib” directory.
The car door finally closed without catching my fingers. The configure and compile then ran successfully.
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment