Question

I want to connect to MySQL from SBCL using CLSQL. I loaded CLSQL using quicklisp (ql:quickload 'clsql). However, when calling (clsql:connect '(...) :database-type :mysql), it said:

Couldn't load foreign libraries "libmysqlclient", "libmysql". (searched CLSQL-SYS:FOREIGN-LIBRARY-SEARCH-PATHS).

I'm on CentOS, and basically what I want to do is

  1. Install mysql client development headers with yum, so UFFI can find it (which I failed to do)
  2. after installing, be able to connect to local MySQL server (I think after 1. is done, it could be working automatically).

I'm currently using:

  • CentOS 5.7 Final (32 bit)
  • SBCL 1.0.55
  • Quicklisp beta
  • yum repositories: base, epel, extras, updates

I didn't just ask about how to install MySQL development headers on CentOS, because that would solve only part of my problem, I would still need to know what's missing from my machine. I also didn't try to build libmysqlclient/libmysql from source, because I don't know whether clsql would be able then to find it or not. I think not.

I'm really sorry if my question somehow misses the point, but extensive googling didn't yield any results. If anyone told me they couldn't install mysql client development headers on CentOS, I would laugh at them and tell them to use yum search, but I couldn't find it neither with yum neither online.

I know the solution for ubuntu (and debian), because there is a cl-sql package and I can easily find mysql headers there too, but I need it on CentOS.

Thanks in advance.

Was it helpful?

Solution

Somehow, when you try something long enough, it will get done ;)

Here's what I did if anyone needs an answer and stumbles upon this question:

(ql:quickload 'clsql)

;tell clsql where to search for mysql libs
(push #P"/usr/lib/mysql" CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*)

;add mysql libs to clsql library path [apparent from code :]
(clsql:push-library-path "/usr/lib/mysql/")

;directly tell uffi to load mysqlclient shared library
(uffi:load-foreign-library "/usr/lib/mysql/libmysqlclient.so")

Of course, you can replace "/usr/lib/mysql" with a different path for mysql libraries, if needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top