A CFFI -ASDF integration bug

Ilya Perminov iperminov at gmail.com
Fri Jul 31 17:17:45 UTC 2020


Hi,

I found a ASDF-related CFFI bug a couple of days ago. Can anyone think of a
good way of fixing it?

A method in grovel/asdf.lisp adds output files of process-op to output
files of compile-op:

;;; Declare the .o and .so files as compilation outputs,
;;; so they get picked up by bundle operations.
#.(when (version<= "3.1.6" (asdf-version))
    '(defmethod output-files ((op compile-op) (c wrapper-file))
      (destructuring-bind (generated-lisp lib-file c-file o-file)
(output-files 'process-op c)
        (declare (ignore generated-lisp c-file))
        (multiple-value-bind (files translatedp) (call-next-method)
          (values (append files (list lib-file o-file)) translatedp)))))

As a result inputs and outputs of the ops look like this:
process-op:
  input: wrapper-file
  output: bindings-file.lisp file.c FILE.O FILE.SO

compile-op:
  input: bindings-file.lisp
  output: bindings-file.fasl FILE.O FILE.SO

The problem is that process-op generates file.o and file.so before it
generates bindings-file.lisp. Thus compile-op gets re-executed all the
time, because its output files file.o and file.so are always older than its
input file bindings-file.lisp. And an execution of the compile-op does not
change anything, because it does not really generate .o and .so.
One way to fix it would be to "touch" .o and .so to get the right order of
file modification times, but there may be a better way.

CFFI bug report: https://bugs.launchpad.net/cffi/+bug/1889491

Thanks,
Ilya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20200731/9748cc3d/attachment.htm>


More information about the asdf-devel mailing list