[Ecls-list] building a static library that depends on CFFI

Simon Ortiz o.simon at gmail.com
Mon Jul 18 04:50:13 UTC 2011


I want to build a static library that uses CFFI. I want to make the
library monolithic. For testing I tried to build a static library that
invokes the C sin function, but I fail to produce the binary. I'm
doing this on a Mac, using ECL 11.1.1, with no :dffi in *features*:

I define a simple package and asd file. Then library file per se, my-cffi.lisp:
(in-package :cffi-test)
(ffi:load-foreign-library "/usr/lib/libm.dylib")
(cffi:defcfun ("sin" c-sin) :double '(:double))

At the REPL I do this:

(require 'asdf)
;; push the location of CFFI and its dependencies
(push "/Users/simon/quicklisp/dists/quicklisp/software/trivial-features-20101006-darcs/"
asdf:*central-registry*)
(push "/Users/simon/quicklisp/dists/quicklisp/software/babel-20101107-darcs/"
asdf:*central-registry*)
(push "/Users/simon/quicklisp/dists/quicklisp/software/alexandria-20110522-git/"
asdf:*central-registry*)
(push "/Users/simon/quicklisp/dists/quicklisp/software/cffi_0.10.6/"
asdf:*central-registry*)
;; push the location of my testing library
(push "/Users/simon/cffi-test/" asdf:*central-registry*)
;; make the library
(asdf:make-build :cffi-test :type :lib :monolithic t :move-here
"/Users/simon/cffi-test/" :ld-flags '("-lm"))

ECL goes to compile and produce code for CFFI and all its
dependencies. Everything seems nice until reaching my-cffi.lisp. I get
this error:

;;; Note:
;;;   Invoking external command:
;;;   gcc -o /Users/simon/.cache/common-lisp/ecl-11.1.1-macosx-x86/Users/simon/cffi-test/my-cffi.fas
-L/opt/ecl/mac/lib/
/private/var/folders/Ph/Ph28pDINHqi3t+OjZePGGE+++TI/-Tmp-/eclinit59IrkC.o
/Users/simon/.cache/common-lisp/ecl-11.1.1-macosx-x86/Users/simon/cffi-test/my-cffi.o
-bundle -lecl -lm /usr/lib/libm.dylib
Condition of type: FILE-ERROR
Filesystem error with pathname
#P"/Users/simon/.cache/common-lisp/ecl-11.1.1-macosx-x86/Users/simon/cffi-test/libcffi-test.a".
Either
 1) the file does not exist, or
 2) we are not allow to access the file, or
 3) the pathname points to a broken symbolic link.

Let's see if libcffi-test.a exists or not, in a shell:
> ls /Users/simon/.cache/common-lisp/ecl-11.1.1-macosx-x86/Users/simon/cffi-test/
my-cffi-package.fas
my-cffi-package.o
my-cffi.fas
my-cffi.o

It seems libcffi-test.a couldn't be produced. Is there a way to get an
error message for why it failed building libcffi-test.a? Or maybe, am
I missing some step required to build libcffi-test.a?

Thank you very much for any help you can provide!

--
Simón Ortiz B., M.Sc., Ing. en Computación
Linux Registered User #388735
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cffi-test.asd
Type: application/octet-stream
Size: 177 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20110718/aa6fb2c7/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my-cffi-package.lisp
Type: application/octet-stream
Size: 51 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20110718/aa6fb2c7/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my-cffi.lisp
Type: application/octet-stream
Size: 120 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20110718/aa6fb2c7/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.log
Type: application/octet-stream
Size: 3370 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20110718/aa6fb2c7/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: repl.lisp
Type: application/octet-stream
Size: 712 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20110718/aa6fb2c7/attachment-0004.obj>


More information about the ecl-devel mailing list