CLSQL and PostgreSQL on Mac OS X
Thursday, July 14, 2005
I've recently been playing around with
Drew Crampsie's new package "lisp-on-lines" which is similar
conceptually to
Ruby on Rails. Actually, the "lisp-on-lines" (LoL) name is both a
take-off of "Ruby on Rails" as well as a
double entendre (but I'll let
you figure the latter one out ;-) ). However, Drew hasn't released LoL
yet, so I can't say too much about it at the moment.
Anyhow, to play with LoL, I needed to also install
Uncommon Web and
CLSQL. Uncommon Web is a
continuation-based web framework which is
very nice and which I'll probably post about soon. CLSQL is a package
that provides database connectivity to a range of different popular
relational databases (see my earlier posts on CLSQL
here and
here). Drew uses essentially the same syntax for representing objects in LoL as
CLSQL does, so your web presentation objects can interact nicely
with your database objects in LoL. Since Drew used
PostgreSQL in one of his examples, I decided to also install
PostgreSQL in order to test LoL. Although I had used CLSQL on Win32, I had never used it on
Mac OS X; however, I thought it would be pretty straight-forward.
First of all, I installed PostgreSQL as per the
instructions on the
Apple developers site. I then
downloaded the latest version of CLSQL (along with the
necessary pre-req's). When I kicked off the build of the
CLSQL/PostgreSQL system definition file, I got the following errors:
; Warning: Error opening shared library "libpq.dylib": image not found ; While executing: FIND-AND-LOAD-FOREIGN-LIBRARY ; Warning: Error opening shared library "libpq.bundle": image not found ; While executing: FIND-AND-LOAD-FOREIGN-LIBRARY
Obviously, CLSQL was not finding the PostgreSQL libraries. A quick check of the CLSQL supported implementations did not say anything about Mac OS X. I started to get worried. So far, I had managed to avoid delving into UFFI (Kevin Rosenberg's package for interfacing CL programs with C libraries) and I wanted to preserve my intellectual virginity with regards to interfacing with foreign libraries in CL ;-), so I called for help on the CLSQL mailing list. Luckily, I had timed my usage of CLSQL on Mac OS X perfectly! Edi Weitz had just submitted a patch to CLSQL which eliminated the previous hard-coded search locations for the C libraries and provided for user-specified locations. There had just been a new point release of CLSQL that included that patch. Edi pointed me to the relevant documentation and (after downloading the new release) I was soon up and running with CLSQL on my Mac.
Incidentally, Sven Van Caekenberghe also pointed out to me via email that I could have used the socket level PostgreSQL interface in CLSQL and avoided UFFI altogether.

