Search code examples
sqlitecommon-lispsbclquicklispclsql

Installing clsql sqlite3 using SBCL + quicklisp


I want to use the sqlite3 interface of clsql. I already install clsql using quicklisp. But when I try to run:

(clsql:with-database (db '("database.db") 
                          :database-type :sqlite3)
  nil)

I get

OPERATION-ERROR while invoking #<COMPILE-OP > on
#<CLSQL-UFFI-SOURCE-FILE "clsql-uffi" "uffi" "clsql_uffi">
   [Condition of type ASDF/BACKWARD-INTERFACE:OPERATION-ERROR]

It is the same if I just try to quicklisp clsql-uffi.

cl-sql,cl-sql-uffi,cl-sql-sqlite3 and libsqlite3-dev are installed. I am using Ubuntu,Linux.


Solution

  • Edit: Separated the problem topics more clearly.

    Installing CLSQL is not always straightforward.

    • CLSQL builds foreign libraries for its database interfaces, so make sure you have build-essentials installed as well. To check that the foreign libraries compile successfully (and if not, to check the error message), I recommend running make on a terminal in the respective directories.

    • There's a bug in clsql makefiles that affect certain systems, most notably AWS instances - check if that applies on your system. Fix the makefiles in the quicklisp's clsql directories as necessary.

    • On earlier Ubuntu versions, I successfully used the distribution's of cl-sql package. On 14.04+, however, they do not usually work too well - so installing clsql from quicklisp is probably a better idea.