The downloadable packages from the MySQL web site contain only static client libraries, but LispWorks need a dynamic library. You need to create the dynamic library, for example by using the shell command:
gcc -dynamiclib -fno-common \
-o /usr/local/mysql/lib/libmysqlclient_r.dylib \
-all_load /usr/local/mysql/lib/libmysqlclient_r.a -lz
This command should be executed as the root user, or some other user with write permission to the
/usr/local/mysql/lib
directory and assumes that MySQL was installed in
/usr/local/mysql
, which is the location used by the prepackaged downloads.
An alternate way to create a dynamic library is to build MySQL from its source code with the
--enable-shared
flag.
By default, LispWorks expects to find the library either in
/usr/local/mysql/lib
or on the shared library path. This can be overridden by setting the special variable
sql:*mysql-library-directories*
, as described in the
LispWorks Reference Manual
.
By default, LispWorks expects the library to be called
libmysqlclient.*.dylib
and it searches for a library that matches that pattern, where
*
is any version number. This search can be avoided by setting
sql:*mysql-library-path*
to something other than the default (
"-lmysqlclient"
), for example, it is possible to force LispWorks to look for version 12 by evaluating
(setq sql:*mysql-library-path* "libmysqlclient.12")
You can also set
sql:*mysql-library-path*
to a full path, which avoids the need to set
sql:*mysql-library-directories*
.
If the environment variable
LW_MYSQL_LIBRARY
. is set, then its value is used instead of the value of
sql:*mysql-library-path*
.