[Ecls-list] C:MAKE-BUILD composition and hierarchical ar shrink-wrapping

Samium Gromoff _deepfire at feelingofgreen.ru
Tue Apr 1 12:15:22 UTC 2008

At Tue, 1 Apr 2008 17:05:41 +0200,
Juan Jose Garcia-Ripoll wrote:
> On Tue, Apr 1, 2008 at 12:18 PM, Samium Gromoff
> <_deepfire at feelingofgreen.ru> wrote:
> > At Tue, 01 Apr 2008 14:05:16 +0400,
> >
> > Samium Gromoff wrote:
> >  >   2. C:MAKE-BUILD :TYPE :FASL, with both cases of monolithicity, complains
> >  > during post-compile LOAD of individual .fas files about not being provided
> >  > with the functions referred to by FFI:DEF-FUNCTION.
> >
> >  The issue appears to have a wider extent than I originally reported,
> >  the :TYPE :SHARED-LIBRARY seems to be affected by this too, in both
> >  cases of monolithicity setting as well.
> I need a more concrete example of this FFI:DEF-FUNCTION issue. It may
> well be that you are doing something that is impossible, such as
> defining a C function in one FASL file which is used (by name) in a
> different file. If this is the case, your only option is to gather
> both systems in the same system, as sub-components. But, as I said, I
> need more information.

Let me illustrate it:

foo.asd: ======= 8< =======

(defpackage :foo.system
  (:use :cl :asdf))

(in-package :foo.system)

(defsystem :foo
  ((:file "foo")
   (:file "foo2" :depends-on ("foo"))))

foo.lisp: ======= 8< =======

(ffi:def-function "a"
  :returning :void)

foo2.lisp: ======= 8< =======

(defun b ()

And building it using:

rm -f *.fas *.o *.so && \
ecl -eval '(require :cmp)' \
    -eval '(require :asdf)' \
    -eval '(asdf:make-build :foo :type :fasl :monolithic t)' \
    -eval '(quit)'

effects in:

;;; Loading #P"/usr/lib/ecl/cmp.fas"
;;; Loading #P"/usr/lib/ecl/sysfun.lsp"
;;; Loading #P"/usr/lib/ecl/asdf.fas"
; loading system definition from foo.asd into #<ASDF0 package>
;;; Loading "/mnt/ext/home/deepfire/local/foo.asd"
; registering #<SYSTEM :FOO 138486456> as FOO
;;; Compiling /mnt/ext/home/deepfire/local/foo.lisp.
;;; Compiling (DEFUN A ...).
;;; End of Pass 1.  
;;; Note: Creating tag: "_eclcdH8L_ZpSBj3" for #P"/mnt/ext/home/deepfire/local/foo.o"
;;; Emitting code for A.
;;; Calling the C compiler... 
;;; Note: Invoking external command:
;;; gcc  -D_GNU_SOURCE -g -O2 -fPIC  -fstrict-aliasing -Dlinux -O "-I/usr/include/" -w -c "/mnt/ext/home/deepfire/local/foo.c" -o "/mnt/ext/home/deepfire/local/foo.o"
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;; Finished compiling /mnt/ext/home/deepfire/local/foo.lisp.
;;; Note: Scanning #P"/mnt/ext/home/deepfire/local/foo.o"
;;; Note: Found tag: "_eclcdH8L_ZpSBj3"
;;; Note: Invoking external command:
;;; gcc  -D_GNU_SOURCE -g -O2 -fPIC  -fstrict-aliasing -Dlinux -O "-I/usr/include/" -w -c "/mnt/ext/home/deepfire/local/ECLINITH9SULi.c" -o "/mnt/ext/home/deepfire/local/ECLINITH9SULi.o"
;;; Note: Invoking external command:
;;; gcc -o "/mnt/ext/home/deepfire/local/foo.fas" -L"/usr/lib/" "/mnt/ext/home/deepfire/local/ECLINITH9SULi.o" "/mnt/ext/home/deepfire/local/foo.o"  -shared    -lecl -ldl  -lm   -lgmp
;;; Loading "/mnt/ext/home/deepfire/local/foo.fas"
An error occurred during initialization:
LOAD: Could not load file "/mnt/ext/home/deepfire/local/foo.fas" (Error: "/mnt/ext/home/deepfire/local/foo.fas: undefined symbol: a").

Note that here I sort of cheat, by providing no information
whatsoever about how to link the C function "a", but feeding
ASDF:MAKE-BUILD the .so doesn't change it.

regards, Samium Gromoff

More information about the ecl-devel mailing list