On Tue, Jan 30, 2018 at 5:01 PM, Attila Lendvai attila@lendvai.name wrote:
if you issue the following (available in quicklisp):
(asdf:load-system :hu.dwim.zlib)
then for the first time it should generate a lisp file, which then gets compiled and loaded.
issuing it for the second time shouldn't do anything, but since some revisions it regenerates the lisp file every time.
the relevant code is somewhere around here:
https://github.com/cffi/cffi/blob/master/src/c2ffi/asdf.lisp#L135
i tried to trace the INPUT-FILES, OUTPUT-FILES, PERFORM, OPERATION-DONE-P methods, but i don't see anything wrong.
one unusual thing is that the output of GENERATE-LISP-OP goes into the src/ directory, not to the usual fasl output dir. same applies to GENERATE-SPEC-OP.
any ideas how to debug this? or what to look at?
I can reproduce the issue using asdf 3.3.1.3 from master (the tag hadn't been pushed, so I pushed it, but the code was already there).
(plan-actions (nth-value 1 (operate 'load-op :hu.dwim.zlib)))
starts with: ((#<CFFI/C2FFI::GENERATE-SPEC-OP > . #<CFFI/C2FFI:C2FFI-FILE "hu.dwim.zlib" "c2ffi-spec" "zlib.h">) (#<CFFI/C2FFI::GENERATE-LISP-OP > . #<CFFI/C2FFI:C2FFI-FILE "hu.dwim.zlib" "c2ffi-spec" "zlib.h">) (#<COMPILE-OP > . #<CFFI/C2FFI:C2FFI-FILE "hu.dwim.zlib" "c2ffi-spec" "zlib.h">) (#<LOAD-OP > . #<CFFI/C2FFI:C2FFI-FILE "hu.dwim.zlib" "c2ffi-spec" "zlib.h">)
So somehow the first action above is considered not done. I suppose it's a bug in c2ffi.
Looking at the c2ffi source, I don't see anything obviously wrong, though you shouldn't the (the (not null) (find-system ...)) since find-system will error out for you if the system is not found (to avoid error, add optional argument nil, as in find-class).
My theory is that that you're failing to re-generate the .spec when it's present, even though your dependencies say it will be re-generated. Therefore, ASDF decides that it's out-of-date and must be re-generated again the next time over, etc. In other words, you lie to ASDF, and ASDF punishes you right back.
To make ASDF happy, you might instead want to have two disjoint operation modes, one to generate the spec files, and one to use it. Normal use mode wouldn't try to generate the file, but instead bork with a useful error message telling you how to generate it and submit it upstream.
Another strategy to make ASDF happy would be to detect whether the file exists as part of input-files and output-files. If it exists, it's in input-files and not output-files; if not, it's in output-files and not input-files. There's something I don't like about this strategy, but it might work (somehow I can't swear it won't bite you back somehow at some point).
Good luck!
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org There is only one thing more harmful to society than an elected official forgetting the promises he made in order to get elected; that's when he doesn't forget them. — John McCarthy