I am trying to use cl-sql
for database access to sqlite3
.
But I am getting the error
Couldn't load foreign libraries "libsqlite3", "sqlite3". (searched CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*: (#P"/usr/lib/clsql/" #P"/usr/lib/"))
The same is with sqlite
.
I have installed sqlite3
using apt-get
and there is a file libsqlite.so.0
in /usr/lib
directory.
I also tried to build sqlite3
from source but I couldn't get the so
file. What is that I am doing wrong?
Your problem is that cl-sql has a third party dependency. If you inspect the implementation of cl-sql (probably under "~/quicklisp/dists/quicklisp/software/clsql-202011220-git/db-sqlite3/sqlite3-loader.lisp") you will see that the function database-type-load-foreign
is trying to load a library named either "libsqlite3" or "sqlite3".
Depending on your operating system this is either looking for a .dll or .so with exactly one of those names.
Given that the version of of libsqlite.so has a different name on your particular distribution of linux, you have a number of different options to make this library work.
ln -s /usr/lib/libsqlite.so.0 /usr/lib/libsqlite3.so
(assuming libsqlite.so.0 is the file that clsql is looking for)CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*
to point to the correct binary if it is installed elsewhere (via clsql:push-libary-path
)