在Debian上,我正在尝试编译一个使用cl-ppcre软件包的CLISP程序。
示例,简化程序(我将其称为变体1)如下所示:
(asdf:load-system :cl-ppcre)
(princ (cl-ppcre:regex-replace-all "a" "abcde" "x"))
(terpri)
当我运行它时::
clisp -q a3.lisp
我明白了:
home:~/clisp/ercpp/compiling-program$ clisp -q a3.lisp
; Loading system definition from /usr/share/common-lisp/systems/cl-ppcre.asd into #<PACKAGE ASDF0>
; Registering #<SYSTEM :CL-PPCRE> as CL-PPCRE
; Registering #<SYSTEM :CL-PPCRE-TEST> as CL-PPCRE-TEST
0 errors, 0 warnings
xbcde
home:~/clisp/ercpp/compiling-program$
但是当我试图编译它时:
clisp -q -c a3.lisp
我明白了:
home:~/clisp/ercpp/compiling-program$ clisp -q -c a3.lisp
;; Compiling file /u/home/clisp/ercpp/compiling-program/a3.lisp ...
*** - READ from
#<INPUT BUFFERED FILE-STREAM CHARACTER
#P"/u/home/clisp/ercpp/compiling-program/a3.lisp" @3>
: there is no package with name "CL-PPCRE"
0 errors, 0 warnings
home:~/clisp/ercpp/compiling-program$
我使用变体2成功运行和不成功编译得到了类似的结果:
(clc:clc-require :cl-ppcre)
(princ (cl-ppcre:regex-replace-all "a" "abcde" "x"))
(terpri)
我需要做些什么才能让它编译?
如果它可能有助于得出答案,我查看了运行变量1触发的文件I / O.我使用了strace,并对输出进行切片和切块以仅显示相关文件和目录的名称。当我这样做时:
strace -o strace.1 clisp -q a3.lisp
grep pcre strace.1 \
| sed -e 's/^[^"]*"//' \
| sed -e 's/".*$//' \
| sort \
| uniq \
> strace.2
我得到了这个输出:
(asdf:load-system :cl-ppcre)\n\n(p
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/api.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/charmap.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/charset.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/chartest.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/closures.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/convert.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/errors.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/lexer.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/optimize.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/packages.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/parser.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/regex-class-util.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/regex-class.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/repetition-closures.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/scanner.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/specials.fas
/u/home/.cache/common-lisp/clisp-2.48-unix-x86/usr/share/common-lisp/source/cl-ppcre/util.fas
/u/home/clisp/ercpp/compiling-program/cl-ppcre-test.asd
/usr/share/common-lisp/source/aima/cl-ppcre-test.asd
/usr/share/common-lisp/source/alexandria/cl-ppcre-test.asd
/usr/share/common-lisp/source/arnesi/cl-ppcre-test.asd
/usr/share/common-lisp/source/arnesi/src/cl-ppcre-extras.lisp
/usr/share/common-lisp/source/aspectl/cl-ppcre-test.asd
/usr/share/common-lisp/source/babel/cl-ppcre-test.asd
/usr/share/common-lisp/source/binary-types/cl-ppcre-test.asd
/usr/share/common-lisp/source/blowfish/cl-ppcre-test.asd
/usr/share/common-lisp/source/cedilla/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-acl-compat/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-asdf/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-cffi/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-fad/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-interpol/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-jpeg/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-launch/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-menusystem/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-pdf/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-photo/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-plplot/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-port/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-ppcre
/usr/share/common-lisp/source/cl-ppcre/.
/usr/share/common-lisp/source/cl-ppcre/api.fas
/usr/share/common-lisp/source/cl-ppcre/api.lisp
/usr/share/common-lisp/source/cl-ppcre/charmap.fas
/usr/share/common-lisp/source/cl-ppcre/charmap.lisp
/usr/share/common-lisp/source/cl-ppcre/charset.fas
/usr/share/common-lisp/source/cl-ppcre/charset.lisp
/usr/share/common-lisp/source/cl-ppcre/chartest.fas
/usr/share/common-lisp/source/cl-ppcre/chartest.lisp
/usr/share/common-lisp/source/cl-ppcre/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-ppcre/cl-ppcre-unicode.asd
/usr/share/common-lisp/source/cl-ppcre/cl-ppcre.asd
/usr/share/common-lisp/source/cl-ppcre/closures.fas
/usr/share/common-lisp/source/cl-ppcre/closures.lisp
/usr/share/common-lisp/source/cl-ppcre/convert.fas
/usr/share/common-lisp/source/cl-ppcre/convert.lisp
/usr/share/common-lisp/source/cl-ppcre/errors.fas
/usr/share/common-lisp/source/cl-ppcre/errors.lisp
/usr/share/common-lisp/source/cl-ppcre/lexer.fas
/usr/share/common-lisp/source/cl-ppcre/lexer.lisp
/usr/share/common-lisp/source/cl-ppcre/optimize.fas
/usr/share/common-lisp/source/cl-ppcre/optimize.lisp
/usr/share/common-lisp/source/cl-ppcre/packages.fas
/usr/share/common-lisp/source/cl-ppcre/packages.lisp
/usr/share/common-lisp/source/cl-ppcre/parser.fas
/usr/share/common-lisp/source/cl-ppcre/parser.lisp
/usr/share/common-lisp/source/cl-ppcre/regex-class-util.fas
/usr/share/common-lisp/source/cl-ppcre/regex-class-util.lisp
/usr/share/common-lisp/source/cl-ppcre/regex-class.fas
/usr/share/common-lisp/source/cl-ppcre/regex-class.lisp
/usr/share/common-lisp/source/cl-ppcre/repetition-closures.fas
/usr/share/common-lisp/source/cl-ppcre/repetition-closures.lisp
/usr/share/common-lisp/source/cl-ppcre/scanner.fas
/usr/share/common-lisp/source/cl-ppcre/scanner.lisp
/usr/share/common-lisp/source/cl-ppcre/specials.fas
/usr/share/common-lisp/source/cl-ppcre/specials.lisp
/usr/share/common-lisp/source/cl-ppcre/util.fas
/usr/share/common-lisp/source/cl-ppcre/util.lisp
/usr/share/common-lisp/source/cl-salza/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-split-sequence/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-statistics/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-utilities/cl-ppcre-test.asd
/usr/share/common-lisp/source/cl-who/cl-ppcre-test.asd
/usr/share/common-lisp/source/closer-mop/cl-ppcre-test.asd
/usr/share/common-lisp/source/contextl/cl-ppcre-test.asd
/usr/share/common-lisp/source/csv/cl-ppcre-test.asd
/usr/share/common-lisp/source/fiveam/cl-ppcre-test.asd
/usr/share/common-lisp/source/ftp/cl-ppcre-test.asd
/usr/share/common-lisp/source/getopt/cl-ppcre-test.asd
/usr/share/common-lisp/source/infix/cl-ppcre-test.asd
/usr/share/common-lisp/source/inflate/cl-ppcre-test.asd
/usr/share/common-lisp/source/ironclad/cl-ppcre-test.asd
/usr/share/common-lisp/source/iterate/cl-ppcre-test.asd
/usr/share/common-lisp/source/kmrcl-tests/cl-ppcre-test.asd
/usr/share/common-lisp/source/kmrcl/cl-ppcre-test.asd
/usr/share/common-lisp/source/lexer/cl-ppcre-test.asd
/usr/share/common-lisp/source/lw-compat/cl-ppcre-test.asd
/usr/share/common-lisp/source/md5/cl-ppcre-test.asd
/usr/share/common-lisp/source/metering/cl-ppcre-test.asd
/usr/share/common-lisp/source/net-telent-date/cl-ppcre-test.asd
/usr/share/common-lisp/source/onlisp/cl-ppcre-test.asd
/usr/share/common-lisp/source/pipes/cl-ppcre-test.asd
/usr/share/common-lisp/source/png/cl-ppcre-test.asd
/usr/share/common-lisp/source/ptester/cl-ppcre-test.asd
/usr/share/common-lisp/source/puri/cl-ppcre-test.asd
/usr/share/common-lisp/source/qbook/cl-ppcre-test.asd
/usr/share/common-lisp/source/readline/cl-ppcre-test.asd
/usr/share/common-lisp/source/regex/cl-ppcre-test.asd
/usr/share/common-lisp/source/reversi/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-bitcomp/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-bool-comp/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-cache/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-delayed/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-filter/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-fuzzy/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-mod/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-modal/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-queue/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-rand/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-random/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-rsa/cl-ppcre-test.asd
/usr/share/common-lisp/source/rsm-string/cl-ppcre-test.asd
/usr/share/common-lisp/source/rt/cl-ppcre-test.asd
/usr/share/common-lisp/source/series/cl-ppcre-test.asd
/usr/share/common-lisp/source/slime/cl-ppcre-test.asd
/usr/share/common-lisp/source/trivial-features/cl-ppcre-test.asd
/usr/share/common-lisp/source/uffi-tests/cl-ppcre-test.asd
/usr/share/common-lisp/source/uffi/cl-ppcre-test.asd
/usr/share/common-lisp/source/units/cl-ppcre-test.asd
/usr/share/common-lisp/source/url-rewrite/cl-ppcre-test.asd
/usr/share/common-lisp/source/usocket/cl-ppcre-test.asd
/usr/share/common-lisp/source/usocket/test/cl-ppcre-test.asd
/usr/share/common-lisp/source/yacc/cl-ppcre-test.asd
/usr/share/common-lisp/source/yaclml/cl-ppcre-test.asd
/usr/share/common-lisp/systems/cl-ppcre-test.asd
/usr/share/common-lisp/systems/cl-ppcre.asd
那我该怎么办?
答案 0 :(得分:11)
如果您编译一些使用(cl-ppcre:bar ...)
这样的包的文件,那么您需要确保该包存在。
编译(asdf:load-system :cl-ppcre)
之类的语句不会导致在编译时加载系统。因此,也不会加载和执行包定义。编译器为此语句生成代码,以便它仅在加载时执行。
要么在编译文件之前以某种方式加载系统,要么使用
(eval-when (:compile-toplevel :load-toplevel :execute)
(asdf:load-system :cl-ppcre))
在文件中以确保它已加载到编译时环境中。