How to use buildapp in combination with quicklisp

2019-03-11 15:05发布

问题:

I want to use buildapp to make the curl-lisp executable given as an example:

buildapp --output lisp-curl --asdf-path ~/src/clbuild/systems/ \
    --load-system drakma \
    --eval '(defun main (args) (write-string (drakma:http-request (second args))))' \
    --entry main

This will most definitly not work, as I got no path "~/src/clbuild/systems/", as I use quicklisp my systems should be at "~/quicklisp/dists/quicklisp/software", but when I execute:

buildapp --output lisp-curl  \
         --asdf-path ~/quicklisp/dists/quicklisp/software      \
         --load-system drakma     \
         --eval '(defun main (args) (write-string (drakma:http-request (second args))))'   \
         --entry main

; file: /home/simkoc/dumper-YKYna1b3.lisp
; in: DEFUN DUMP-FILE-DEBUGGER
;     (QUIT :UNIX-STATUS 111)
; 
; caught STYLE-WARNING:
;   SB-EXT:QUIT has been deprecated as of SBCL 1.0.56.55. Use SB-EXT:EXIT or
;   SB-THREAD:ABORT-THREAD instead.
;   
;   In future SBCL versions SB-EXT:QUIT will signal a full warning at compile-time.
; 
; compilation unit finished
;   caught 1 STYLE-WARNING condition
Fatal MISSING-COMPONENT:
  Component "drakma" not found

This answer to a question already hints that quicklisp is able to export its systems in a way that buildapp is able to retrieve it, but sadly does not go into details.

I also tried leaving the --asdf-path out, as SBCL (when started) is already able to load Drakma using (require 'drakma) or (asdf:load-system "drakma"). Also using --require instead of --load-system won't do the deal.

Therefore: How can I use buildapp in combination with quicklisp to make an executable with required systems (I just car about the MISSING-COMPONENT PART)

回答1:

If Drakma is already installed in quicklisp, I think your example will work if you use --asdf-tree instead of --asdf-path. But using the Quicklisp directory as a tree can cause some trouble, as not every system file in the tree is meant to be loaded.

There's another option that more closely integrates with Quicklisp's knowledge of available systems. Here's what I do:

sbcl --no-userinit --no-sysinit --non-interactive \
     --load ~/quicklisp/setup.lisp \
     --eval '(ql:quickload "drakma")' \
     --eval '(ql:write-asdf-manifest-file "quicklisp-manifest.txt")'

buildapp --manifest-file quicklisp-manifest.txt --load-system drakma [the rest of your options]

The first command ensures that drakma has been downloaded, and that an index of the systems Quicklisp knows about is in quicklisp-manifest.txt. The second uses that index to build the application using installed Quicklisp systems.