Fixing CLSQL on OSX 10.5.8

I recently had the need to run some older Lisp code on OSX 10.5.8 which used CLSQL, unfortunately this was enough to cause me a couple of lost hours trying to compile and load the CLSQL helper libraries.


I decided to start slowly by starting my Common Lisp implementation and running each of the following lines in the REPL.

I was greeted with the debugger, which I can’t say was a big surprise because I remembered having to compile some C helper libraries when I last used CLSQL on Linux. I checked clsql source inside quicklisp’s folder (~/quicklisp/dists/quicklisp/software/clsql-20101207-git/ in my case) and noticed the obvious Makefile there. My first (dumb) instinct was to jump right in and try to run make

Which failed miserably because I didn’t have the development tools installed. So basically I had to get a running compiler and necessary tools like make.

I’m assuming you already have MySQL and all the necessary development headers (personally I installed it from a MySQL DMG image file I got from MySQL’s website and it came with all the required headers)

2. Getting GCC, make and required system development headers

As I googled around for indications on how to install GCC I noticed a pattern, most results suggested the need to install XCode 3.1.4 (apparently is the last version to run on OSX 10.5.x) which I found at Apple’s development center. I believe you need to register as a developer in order to actually download the software. After getting the 1Gb disk image I didn’t follow the regular install procedure and instead went into the Packages folder and installed the following packages:

DeveloperToolsCLI.pkg
DevSDK.pkg
gcc4.0.pkg

3. Compiling CLSQL helper libraries

With all the required tools i went back to CLSQL’s source tried running make again. The results weren’t all that better:

Basically this means that the first helper library packaged with CLSQL (clsql_mysql) failed to compile. After looking around the web I found that I should be replacing the string

by

on all occurences of lines similar to:

in both “db-mysql/Makefile” and “uffi/Makefile” files. These minor changes have allowed me to successfully compile both helper libraries (db-mysql.dylib and clsql_uffi.dylib)

4. Conclusion

After completing these steps, I restarted my Lisp image and repeated the commands listed at the beginning of this post, I got one more error telling me it couldn’t load the libmysqlclient library but I solved that by adding the path to libmysqlclient. Something like the following lines

Leave a Reply

Your email address will not be published. Required fields are marked *