[cffi-devel] CFFI fails to load libs on 64bit machine

Heiko Schroeter schroete at iup.physik.uni-bremen.de
Wed Apr 26 08:45:03 UTC 2006


Hello,

i'am using the CFFI on 32-bit machines without any problem.
Switching to a 64-bit platform breaks the loading of a lib.

uname -a:
Linux master 2.6.8-24-smp #1 SMP Wed Oct 6 09:16:23 UTC 2004 x86_64 x86_64 
x86_64 GNU/Linux

/etc/SuSE-release:
SuSE Linux 9.2 (x86-64)
VERSION = 9.2

sbcl:
SBCL 0.9.11

library:
libgslcblas.so.0 (libc6,x86-64) => /usr/lib/libgslcblas.so.0
libgslcblas.so (libc6,x86-64) => /usr/lib/libgslcblas.so
libgsl.so.0 (libc6,x86-64) => /usr/lib/libgsl.so.0
libgsl.so (libc6,x86-64) => /usr/lib/libgsl.so

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
The small lisp prog:
(defpackage :cffi-user
   (:use :common-lisp :cffi))
(in-package :cffi-user)

(pushnew #P"/usr/local/lib/" *foreign-library-directories*
         :test #'equal)

; alternative 1
(define-foreign-library libgslcblas
  (:unix (:or "libgslcblas.so.0.0.0" "libgslcblas.so.0"))
  (t (:default "libgslcblas")))
; alternative 2
(define-foreign-library libgslcblas
  (t (:default "libgslcblas")))

(use-foreign-library libgslcblas) <---the error happens here

(define-foreign-library libgsl
  (:unix (:or "libgsl.so.0.9.0" "libgsl.so.0"))
  (t (:default "libgsl")))
(use-foreign-library libgsl)


;;;;
(defcfun "gsl_sf_bessel_J0" :double (x :double))
(time (format t "~A~%" (gsl-sf-bessel-J0 5d0)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; END

The error message:
Unable to load foreign library: libgslcblas.so
   [Condition of type LOAD-FOREIGN-LIBRARY-ERROR]
 0: (CFFI::HANDLE-LOAD-FOREIGN-LIBRARY-ERROR "libgslcblas.so" "Unable to load 
foreign library: ~A" "libgslcblas.so")

It doesn't matter if i use alternative 1 or 2.

Is it a general matter that CFFI cannot handle 64-bit libs ?

Regards
Heiko




More information about the cffi-devel mailing list