CFFI fails to find libraries on Nix / Guix. This is (probably) because those two
distributions don't follow the traditional filesystem hierarchy /lib,
/usr/lib, etc.
For instance, trying to load sqlite-lib yields the following backtrace:
--8<---------------cut here---------------start------------->8---
Unable to load any of the alternatives:
("libsqlite3.so.0" "libsqlite3.so")
[Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
Restarts:
0: [RETRY] Try loading the foreign library again.
1: [USE-VALUE] Use another library instead.
2: [TRY-RECOMPILING] Recompile sqlite-ffi and try loading it again
3: [RETRY] Retry loading FASL for #<CL-SOURCE-FILE "sqlite" "sqlite-ffi">.
4: [ACCEPT] Continue, treating loading FASL for #<CL-SOURCE-FILE "sqlite" "sqlite-ffi"> as having been successful.
5: [RETRY] Retry ASDF operation.
--more--
Backtrace:
0: (CFFI::FL-ERROR "Unable to load any of the alternatives:~% ~S" ("libsqlite3.so.0" "libsqlite3.so"))
1: (CFFI::TRY-FOREIGN-LIBRARY-ALTERNATIVES SQLITE3-LIB ("libsqlite3.so.0" "libsqlite3.so") NIL)
2: ((FLET CFFI::%DO-LOAD :IN CFFI::%DO-LOAD-FOREIGN-LIBRARY) #<FOREIGN-LIBRARY SQLITE3-LIB> SQLITE3-LIB (:OR "libsqlite3.so.0" "libsqlite3.so"))
3: (LOAD-FOREIGN-LIBRARY SQLITE3-LIB :SEARCH-PATH NIL)
4: (SB-FASL::LOAD-FASL-GROUP #S(SB-FASL::FASL-INPUT :STREAM #<SB-SYS:FD-STREAM for "file /home/ambrevar/.cache/common-lisp/sbcl-1.4.4-linux-x64/home/ambrevar/quicklisp/dists/quicklisp/software/cl-sqlite-..
5: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file /home/ambrevar/.cache/common-lisp/sbcl-1.4.4-linux-x64/home/ambrevar/quicklisp/dists/quicklisp/software/cl-sqlite-20130615-git/sqlite-ffi.fasl" {100..
6: ((FLET SB-FASL::THUNK :IN LOAD))
7: (SB-FASL::CALL-WITH-LOAD-BINDINGS #<CLOSURE (FLET SB-FASL::THUNK :IN LOAD) {7FFFF6E4E31B}> #<SB-SYS:FD-STREAM for "file /home/ambrevar/.cache/common-lisp/sbcl-1.4.4-linux-x64/home/ambrevar/quicklisp/d..
8: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-SYS:FD-STREAM for "file /home/ambrevar/.cache/common-lisp/sbcl-1.4.4-linux-x64/home/ambrevar/quicklisp/dists/quicklisp/software/cl-sqlite-20130615-git/sqlite..
9: (LOAD #P"/home/ambrevar/.cache/common-lisp/sbcl-1.4.4-linux-x64/home/ambrevar/quicklisp/dists/quicklisp/software/cl-sqlite-20130615-git/sqlite-ffi.fasl" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :E..
10: (UIOP/UTILITY:CALL-WITH-MUFFLED-CONDITIONS #<CLOSURE (LAMBDA NIL :IN UIOP/LISP-BUILD:LOAD*) {1002424CEB}> ("Overwriting already existing readtable ~S." #(#:FINALIZERS-OFF-WARNING :ASDF-FINALIZERS)))
11: ((SB-PCL::EMF ASDF/ACTION:PERFORM) #<unused argument> #<unused argument> #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sqlite" "sqlite-ffi">)
12: ((LAMBDA NIL :IN ASDF/ACTION:CALL-WHILE-VISITING-ACTION))
13: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS (ASDF/LISP-ACTION:LOAD-OP ASDF/LISP-ACTION:CL-SOURCE-FILE)) #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sqlite" "sqlite-ffi">) [fast-met..
14: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)) #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/LISP-ACTION:CL-SOURCE-FILE "sqlite" "sqlite-ffi">) [fast-method]
15: ((:METHOD ASDF/PLAN:PERFORM-PLAN (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {10021FC613}>) [fast-method]
16: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
17: ((:METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {10021FC613}>) [fast-method]
18: ((:METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/SYSTEM:SYSTEM "sqlite"> :PLAN-CLASS NIL :PLAN-OPTIONS NIL) [fast-method]
19: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) #<unused argument> #<unused argument> #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/SYSTEM:SYSTEM "sqlite"> :VERBOSE NIL)
20: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
21: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) #<ASDF/LISP-ACTION:LOAD-OP > #<ASDF/SYSTEM:SYSTEM "sqlite"> :VERBOSE NIL) [fast-method]
22: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) #<unused argument> #<unused argument> ASDF/LISP-ACTION:LOAD-OP "sqlite" :VERBOSE NIL)
23: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
24: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "sqlite" :VERBOSE NIL) [fast-method]
25: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<CLOSURE (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {10021F140B}> :OVERRIDE T :KEY NIL :OVERRIDE-CACHE T :OVERRIDE-FORCING NIL)
26: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
27: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<CLOSURE (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {10021E896B}> :OVERRIDE NIL :KEY NIL :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
28: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:LOAD-OP "sqlite" :VERBOSE NIL) [fast-method]
29: (ASDF/OPERATE:LOAD-SYSTEM "sqlite" :VERBOSE NIL)
30: (QUICKLISP-CLIENT::CALL-WITH-MACROEXPAND-PROGRESS #<CLOSURE (LAMBDA NIL :IN QUICKLISP-CLIENT::APPLY-LOAD-STRATEGY) {10021E88CB}>)
31: (QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "sqlite" :PROMPT NIL)
32: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION (T T)) #<unused argument> #<CLOSURE (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {10021D574B}>) [fast-method]
33: ((:METHOD QL-IMPL-UTIL::%CALL-WITH-QUIET-COMPILATION :AROUND (QL-IMPL:SBCL T)) #<QL-IMPL:SBCL {10054D58E3}> #<CLOSURE (FLET QUICKLISP-CLIENT::QL :IN QUICKLISP-CLIENT:QUICKLOAD) {10021D574B}>) [fast-me..
34: ((:METHOD QUICKLISP-CLIENT:QUICKLOAD (T)) :SQLITE :PROMPT NIL :SILENT NIL :VERBOSE NIL) [fast-method]
35: (QL-DIST::CALL-WITH-CONSISTENT-DISTS #<CLOSURE (LAMBDA NIL :IN QUICKLISP-CLIENT:QUICKLOAD) {10021CD67B}>)
36: (SB-INT:SIMPLE-EVAL-IN-LEXENV (QUICKLISP-CLIENT:QUICKLOAD :SQLITE) #<NULL-LEXENV>)
37: (EVAL (QUICKLISP-CLIENT:QUICKLOAD :SQLITE))
38: (SB-EXT:INTERACTIVE-EVAL (QUICKLISP-CLIENT:QUICKLOAD :SQLITE) :EVAL NIL)
39: (SB-IMPL::REPL-FUN NIL)
40: ((LAMBDA NIL :IN SB-IMPL::TOPLEVEL-REPL))
41: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-IMPL::TOPLEVEL-REPL) {100335BB1B}>)
42: (SB-IMPL::TOPLEVEL-REPL NIL)
43: (SB-IMPL::TOPLEVEL-INIT)
44: ((FLET SB-UNIX::BODY :IN SB-EXT:SAVE-LISP-AND-DIE))
45: ((FLET "WITHOUT-INTERRUPTS-BODY-27" :IN SB-EXT:SAVE-LISP-AND-DIE))
46: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))
--8<---------------cut here---------------end--------------->8---
Any idea on how to fix this?
--
Pierre Neidhardt