Need help from Lisp wizards — looks like I'm missing something simple and obvious (but not so obvious for beginner).
-
Need help from Lisp wizards — looks like I'm missing something simple and obvious (but not so obvious for beginner). I'm trying to build (with ECL) the simple program, which uses ql:quickload to load parse-number, then prints "Hello world". It builds without errors, but resulting binary could not be executed — it prints error message about unknown "ql:quickload" function.
QuickLisp was installed like described in the official documentation. It works in SBCL, it works in ECL REPL and it has the necessary lines in the ~/.eclrc:
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
(ql:quickload '(:slite) :silent t)The program, itself, runs successfully if I just evaluate the next code in the REPL:
(ql:quickload '(:parse-number) :silent t)
(defpackage :test
(:use :cl))(in-package :test)
(defun toplevel ()
(print "Hello world"))(progn
(toplevel)
(ext:quit))And it compiles:
ecl --eval '(progn (compile-file "test.lisp" :system-p t) (c:build-program "test" :lisp-files '"'"'("test.o")) (quit))'
;;; Loading #P"/home/drag0n/quicklisp/setup.lisp"
;;; Loading #P"/usr/local/lib/ecl-24.5.10/asdf.fas"
;;;
;;; Compiling test.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling test.lisp.
;;;But doesn't print "Hello world":
./test
Condition of type: UNDEFINED-FUNCTION
The function QUICKLISP-CLIENT::QUICKLOAD is undefined.
No restarts available.Top level in: #<process TOP-LEVEL 0x8295a3f80>.
>#AskFedi #CommonLisp #ECL #QuickLisp

-
Need help from Lisp wizards — looks like I'm missing something simple and obvious (but not so obvious for beginner). I'm trying to build (with ECL) the simple program, which uses ql:quickload to load parse-number, then prints "Hello world". It builds without errors, but resulting binary could not be executed — it prints error message about unknown "ql:quickload" function.
QuickLisp was installed like described in the official documentation. It works in SBCL, it works in ECL REPL and it has the necessary lines in the ~/.eclrc:
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
(ql:quickload '(:slite) :silent t)The program, itself, runs successfully if I just evaluate the next code in the REPL:
(ql:quickload '(:parse-number) :silent t)
(defpackage :test
(:use :cl))(in-package :test)
(defun toplevel ()
(print "Hello world"))(progn
(toplevel)
(ext:quit))And it compiles:
ecl --eval '(progn (compile-file "test.lisp" :system-p t) (c:build-program "test" :lisp-files '"'"'("test.o")) (quit))'
;;; Loading #P"/home/drag0n/quicklisp/setup.lisp"
;;; Loading #P"/usr/local/lib/ecl-24.5.10/asdf.fas"
;;;
;;; Compiling test.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Finished compiling test.lisp.
;;;But doesn't print "Hello world":
./test
Condition of type: UNDEFINED-FUNCTION
The function QUICKLISP-CLIENT::QUICKLOAD is undefined.
No restarts available.Top level in: #<process TOP-LEVEL 0x8295a3f80>.
>#AskFedi #CommonLisp #ECL #QuickLisp

@evgandr SBCL makes a snapshot of the current program state, while ECL builds .o objects that are linked together from files.
That means, that when you restore program saved with SLAD, then Quicklisp is already loaded (because it was loaded when you've built the program), while in ECL the program is started from skratch in the initial environment.
In other words, when you start ECL program (assuming that it loads initrc):
- start core
- start additional compiled-in objects
- load initscript (i.e load quicklisp)but you reference quicklisp in compiled-in objects.
If you want to ensure that ASDF systems are linked in without such hassle, use ASDF operator make-build (documented in ECL manual).
Also note, that if you depend on UIOP, then manually download the library and put it in your local-projects (that ASDF quirk), because otherwise ASDF will assume that UIOP is /always/ present and won't try to build it.
-
S stefano@mastodon.bsd.cafe shared this topic