gpt4 book ai didi

lisp - ecl 如何在可执行文件中包含 asdf 依赖项? (取2)

转载 作者:太空宇宙 更新时间:2023-11-03 18:48:50 24 4
gpt4 key购买 nike

这个问题是由 ayrnieu 提出并回答的

How can ECL include ASDF dependencies in an executable?

但他链接的示例代码实际上不涉及任何依赖项。我试过在他提到的 stumpwm 代码中复制模型,但我无法让它工作。他是我的文件。

---- ecl-test.asd ----

(defsystem "ecl-test"
:description "test of asdf:make-build"
:depends-on (:mydefs)
:components ((:file "package")
(:file "ecl-test" :depends-on ("package"))
(:file "main" :depends-on ("package" "ecl-test"))
)
)

---- ecl-test.lisp ----

    (in-package :ecl-test)

(defun test ()
(format t "testing...~%")

;; Note that with the next line commented out,
;; the program never uses the package "mydefs".
;; (format t (write-to-string (mydefs:number-sequence :from 2 :to 7)))

(format t "...done~%"))

---- package.lisp ----

(defpackage :ecl-test
(:use :cl
:mydefs
)
(:export :test))

---- main.lisp ----

(ecl-test:test)
(ext:quit)

编译成功(在 slime 中):

CL-USER> (asdf:make-build 'ecl-test :type :program :monolithic t :epilogue-code '(ext:quit 0))

; loading system definition from /home/dabrowsa/lisp/ecl-test/ecl-test.asd into
; #<ASDF0 package>
;;; Loading "/home/dabrowsa/lisp/ecl-test/ecl-test.asd"
;;; Compiling /home/dabrowsa/lisp/ecl-test/package.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=3
;;; End of Pass 1.
;;; Note: Creating tag: "_eclitxZgyvjVscp1_KzxnJ9z" for #P"/home/dabrowsa/lisp/ecl-test/package.o"
;;; Note: Invoking external command:
;;; gcc "-I/usr/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c "/home/dabrowsa/lisp/ecl-test/package.c" -o "/home/dabrowsa/lisp/ecl-test/package.o"
;;; Finished compiling /home/dabrowsa/lisp/ecl-test/package.lisp.
;;; Note: Scanning #P"/home/dabrowsa/lisp/ecl-test/package.o"
;;; Note: Found tag: "_eclitxZgyvjVscp1_KzxnJ9z" for /home/dabrowsa/lisp/ecl-test/package.o
;;; Note: Invoking external command:
;;; gcc "-I/usr/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c "/tmp/ECLINITMs8gOO.c" -o "/tmp/ECLINITMs8gOO.o"
;;; Note: Invoking external command:
;;; gcc -o "/home/dabrowsa/lisp/ecl-test/package.fas" -L"/usr/lib/" "/tmp/ECLINITMs8gOO.o" "/home/dabrowsa/lisp/ecl-test/package.o" -shared -lecl -lgmp -lgc -ldl -lm
;;; Loading "/home/dabrowsa/lisp/ecl-test/package.fas"
;;; Compiling /home/dabrowsa/lisp/ecl-test/ecl-test.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=3
;;; Compiling (DEFUN TEST ...).
;;; End of Pass 1.
;;; Note: Creating tag: "_eclclGsJgWGIqMw1_y1ynJ9z" for #P"/home/dabrowsa/lisp/ecl-test/ecl-test.o"
;;; Emitting code for TEST.
;;; Note: Invoking external command:
;;; gcc "-I/usr/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c "/home/dabrowsa/lisp/ecl-test/ecl-test.c" -o "/home/dabrowsa/lisp/ecl-test/ecl-test.o"
;;; Finished compiling /home/dabrowsa/lisp/ecl-test/ecl-test.lisp.
;;; Note: Scanning #P"/home/dabrowsa/lisp/ecl-test/ecl-test.o"
;;; Note: Found tag: "_eclclGsJgWGIqMw1_y1ynJ9z" for /home/dabrowsa/lisp/ecl-test/ecl-test.o
;;; Note: Invoking external command:
;;; gcc "-I/usr/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c "/tmp/ECLINITg28qfo.c" -o "/tmp/ECLINITg28qfo.o"
;;; Note: Invoking external command:
;;; gcc -o "/home/dabrowsa/lisp/ecl-test/ecl-test.fas" -L"/usr/lib/" "/tmp/ECLINITg28qfo.o" "/home/dabrowsa/lisp/ecl-test/ecl-test.o" -shared -lecl -lgmp -lgc -ldl -lm
;;; Loading "/home/dabrowsa/lisp/ecl-test/ecl-test.fas"
;;; Compiling /home/dabrowsa/lisp/ecl-test/main.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=3
;;; End of Pass 1.
;;; Note: Creating tag: "_eclJi0DFzaXyAEw1_4LynJ9z" for #P"/home/dabrowsa/lisp/ecl-test/main.o"
;;; Note: Invoking external command:
;;; gcc "-I/usr/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c "/home/dabrowsa/lisp/ecl-test/main.c" -o "/home/dabrowsa/lisp/ecl-test/main.o"
;;; Finished compiling /home/dabrowsa/lisp/ecl-test/main.lisp.
;;; Note: Scanning #P"/home/dabrowsa/lisp/ecl-test/main.o"
;;; Note: Found tag: "_eclJi0DFzaXyAEw1_4LynJ9z" for /home/dabrowsa/lisp/ecl-test/main.o
;;; Note: Invoking external command:
;;; gcc "-I/usr/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c "/tmp/ECLINITeop9MY.c" -o "/tmp/ECLINITeop9MY.o"
;;; Note: Invoking external command:
;;; gcc -o "/home/dabrowsa/lisp/ecl-test/main.fas" -L"/usr/lib/" "/tmp/ECLINITeop9MY.o" "/home/dabrowsa/lisp/ecl-test/main.o" -shared -lecl -lgmp -lgc -ldl -lm
;;; Note: Scanning #P"/home/dabrowsa/lisp/ecl-test/main.o"
;;; Note: Found tag: "_eclJi0DFzaXyAEw1_4LynJ9z" for /home/dabrowsa/lisp/ecl-test/main.o
;;; Note: Scanning #P"/home/dabrowsa/lisp/ecl-test/ecl-test.o"
;;; Note: Found tag: "_eclclGsJgWGIqMw1_y1ynJ9z" for /home/dabrowsa/lisp/ecl-test/ecl-test.o
;;; Note: Scanning #P"/home/dabrowsa/lisp/ecl-test/package.o"
;;; Note: Found tag: "_eclitxZgyvjVscp1_KzxnJ9z" for /home/dabrowsa/lisp/ecl-test/package.o
;;; Note: Invoking external command:
;;; gcc "-I/usr/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c "/tmp/ECLINITsLgWth.c" -o "/tmp/ECLINITsLgWth.o"
;;; Note: Invoking external command:
;;; ar cr /home/dabrowsa/lisp/ecl-test/libecl-test.a /tmp/ECLINITsLgWth.o /home/dabrowsa/lisp/ecl-test/package.o /home/dabrowsa/lisp/ecl-test/ecl-test.o /home/dabrowsa/lisp/ecl-test/main.o
;;; Note: Invoking external command:
;;; ranlib /home/dabrowsa/lisp/ecl-test/libecl-test.a
;;; Note: Invoking external command:
;;; gcc "-I/usr/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c "/tmp/ECLINITTF1dqA.c" -o "/tmp/ECLINITTF1dqA.o"
;;; Note: Invoking external command:
;;; gcc -o "/home/dabrowsa/lisp/ecl-test/ecl-test-mono" -L"/usr/lib/" "/tmp/ECLINITTF1dqA.o" "/home/dabrowsa/lisp/ecl-test/libecl-test.a" -lecl -lgmp -lgc -ldl -lm #<ASDF::PROGRAM-OP NIL 38147728>

但是执行 ecl-test-mono 会产生错误。

~/lisp/ecl-test$ ./ecl-test-mono

The function ASDF::SYSTEM-REGISTERED-P is undefined.
No restarts available.

Broken at NIL.
ECL-TEST>>

SYSTEM-REGISTERED-P 似乎是 ASDF 中未导出的函数,我不知道为什么会出现在这里,但是,我是新手所以我知道什么。

最佳答案

你最好在 ecls-list 上问这个问题。

或者在调用 MAKE-BUILD 时尝试这样做:

:prologue-code '(require :asdf)

关于lisp - ecl 如何在可执行文件中包含 asdf 依赖项? (取2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2128658/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com