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

Attachment: cffi-test.asd
Description: Binary data

Attachment: my-cffi-package.lisp
Description: Binary data

Attachment: my-cffi.lisp
Description: Binary data

Attachment: error.log
Description: Binary data

Attachment: repl.lisp
Description: Binary data

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to