[cffi-devel] CFFI-GROVEL ASDF integration

Mark Cox markcox80 at gmail.com
Mon Nov 5 11:57:58 UTC 2012


Hi Luis,

On 05/11/2012, at 3:01 AM, Luís Oliveira wrote:

> Hello Mark,
> 
> On Wed, Oct 24, 2012 at 1:04 PM, Mark Cox <markcox80 at gmail.com> wrote:
>> There is an issue with the ASDF component of CFFI-GROVEL when running on ECL. The problem stems from ASDF:OUTPUT-FILES returning two items. The attached patch hopes to handle this situation.
> 
> I haven't touched this code in quite while and I don't remember
> exactly what's going on. Why is ASDF:OUTPUT-FILES returning two items?

The result of ASDF:OUTPUT-FILES on cffi/src/utils.lisp is the following when using ECL (see code at the end of the email). 

(#P"/tmp/quicklisp/dists/quicklisp/software/cffi_0.10.7.1/src/utils.o"
 #P"/tmp/quicklisp/dists/quicklisp/software/cffi_0.10.7.1/src/utils.fas")
T

As you can see, ECL's ASDF:OUTPUT-FILES on CL source files returns a list with more than one element. The first item, utils.o, is an object file created using COMPILE-FILE with :SYSTEM-P T. The second is a FASl file created using COMPILE-FILE with no keywords. From line 4411 of [1], "having both of them allows us to later on reuse the object files for bundles, libraries and standalone executables." More information on the distinction between the two outputs can be found in [2].

> Could you also explain why :SYSTEM-P T is no longer always passed on
> to COMPILE-FILE?


:SYSTEM-P is only required to create the object file. Upon inspection of ASDF sources, they avoid the second compilation by (re)using the object file to create the FASl file. See COMPILE-FILE-KEEPING-OBJECT in [1].

I think there are two ways to proceed. The first is to stick with the assumption that the list returned by ASDF:OUTPUT-FILES only contains one item, but process that single item according to the current lisp machine. The second is to assume that ASDF:OUTPUT-FILES can return any number of items. The later is the approach my patch took with the introduction of %COMPILE-FILE-TO-PATHNAME. The problem with the later is that it is not specified how one creates the output file from the input source file. I am not sure if Juan reads this list. He may have a better idea on how to achieve this approach.

I will wait for your advice on how to proceed.

Thanks
Mark

[1] asdf.lisp from ASDF or ecl/contrib/asdf/asdf.lisp. 
[2] http://ecls.sourceforge.net/new-manual/ch32s02.html


(defun ecl-test ()
  (let* ((cffi-src        (asdf:find-component (asdf:find-system "cffi")
					       "src"))
	 (utils-component (asdf:find-component cffi-src 
					       "utils")))
    ;; utils-component is the asdf component representing cffi/src/utils.lisp
    (asdf:output-files (make-instance 'asdf:compile-op) utils-component)))





More information about the cffi-devel mailing list