Hello,
I'm having trouble loading libraries using CFFI 0.9.0 on debian. Example:
The test script:
(defpackage #:test (:use #:common-lisp #:cffi))
(in-package #:test)
(defun load-library () (define-foreign-library libc (t (:default "libc"))) (use-foreign-library libc) (format t "libc loaded~%"))
(load-library)
Gives: Unable to load foreign library: libc.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: [ABORT-REQUEST] Abort handling SLIME request. 3: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {B1BED31}>)
Backtrace: 0: (CFFI::HANDLE-LOAD-FOREIGN-LIBRARY-ERROR "libc.so" "Unable to load foreign library: ~A" "libc.so") 1: (LOAD-FOREIGN-LIBRARY LIBC) 2: (LOAD-LIBRARY) 3: (SB-INT:EVAL-IN-LEXENV (LOAD-LIBRARY) #<NULL-LEXENV>) 4: (SWANK::EVAL-REGION "(load-library) " T) 5: ((LAMBDA NIL)) 6: ((SB-PCL::FAST-METHOD SWANK-BACKEND:CALL-WITH-SYNTAX-HOOKS (T)) #<unused argument> #<unused argument> #<CLOSURE (LAMBDA NIL) {B75B0C5}>) 7: (SWANK::CALL-WITH-BUFFER-SYNTAX #<CLOSURE (LAMBDA NIL) {B75B0C5}>) 8: (SB-INT:EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(load-library) ") #<NULL-LEXENV>) 9: ((LAMBDA NIL)) 10: ((SB-PCL::FAST-METHOD SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK (T T)) #<unused argument> #<unused argument> #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL) {B75AA35}>) 11: ((LAMBDA NIL)) 12: ((SB-PCL::FAST-METHOD SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK (T T)) #<unused argument> #<unused argument> #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL) {A9F13C5}>) 13: (SWANK::CALL-WITH-REDIRECTED-IO #<SWANK::CONNECTION {B01AC89}> #<CLOSURE (LAMBDA NIL) {B75A8E5}>) 14: (SWANK::CALL-WITH-CONNECTION #<SWANK::CONNECTION {B01AC89}> #<FUNCTION (LAMBDA NIL) {A9F13C5}>) 15: (SWANK::HANDLE-REQUEST #<SWANK::CONNECTION {B01AC89}>) 16: ((LAMBDA NIL)) 17: ((LAMBDA NIL)) 18: ((SB-PCL::FAST-METHOD SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK (T T)) #<unused argument> #<unused argument> #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL) {B1DA0B5}>) 19: (SWANK::CALL-WITH-REDIRECTED-IO #<SWANK::CONNECTION {B01AC89}> #<CLOSURE (LAMBDA NIL) {B1DA0C5}>) 20: (SWANK::CALL-WITH-CONNECTION #<SWANK::CONNECTION {B01AC89}> #<CLOSURE (LAMBDA NIL) {B1DA0B5}>) 21: (SWANK::CALL-WITH-BINDINGS NIL #<CLOSURE (LAMBDA NIL) {B1DA095}>) 22: ((LAMBDA NIL)) 23: ("foreign function: call_into_lisp") 24: ("foreign function: funcall0") 25: ("foreign function: new_thread_trampoline") 26: ("foreign function: #xB7FCECED")
It is hard to imagine that it can't find the library so I'd guess it is some problem with the loader? dlopen? I'm using SBCL 0.9.11 & debian 2.6.15-1-686 #2 Mon Mar 6 15:27:08 UTC 2006 i686 GNU/Linux
Suggestions?
Thanks, -Hazen