Dear all,
I am currently trying to make maxima, a computer algebra system written in lisp, support out-of-tree builds:
- The contents of the source tarball is kept in a directory and left completely unmodified and - all files generated during the build are kept in a potentially different directory.
Since 2 of the lisp files containing (defparameter) commands are generated by the build scripts
- the build process is started in the directory the output will end up in - an (mk:add-registry-location "$(top_srcdir)/src/") informs defsystem where to find the source tree and - in maxima.system all files that are in the build tree instead are marked as private-file:
(:module final :source-pathname "" ;; These are not compiled, for whatever reason #-ecl :load-only #-ecl t :components ((:file "autol") (:file "max_ext") :private-file "share-subdirs") (:file "init-cl")))))
This seems to work fine in sbcl, clisp, ecl, openmcl, gcl and cmucl. And with ECL maxima seems to build fine, as well. But when I start a maxima that was compiled with ECL it generates a runtime error that the variables share-subdirs defines are not bound.
I am no defsystem expert, neither a lisp expert so I expect to have done something obviously wrong. But as it works in all other lisps I've tried I hope ecl-devel is the right place to ask at.
Thanks a lot,
and kind regards,
Gunter.
Hey Gunter,
I don't know mk-defsystem, but I have an idea what is wrong.
Since 2 of the lisp files containing (defparameter) commands are generated by the build scripts
the short answer is that these files need to be part of the build. See longer answer below.
- the build process is started in the directory the output will end
up in
- an (mk:add-registry-location "$(top_srcdir)/src/") informs
defsystem where to find the source tree and
- in maxima.system all files that are in the build tree instead are
marked as private-file:
(:module final :source-pathname "" ;; These are not compiled, for whatever reason #-ecl :load-only #-ecl t :components ((:file "autol") (:file "max_ext") :private-file "share-subdirs") (:file "init-cl")))))
This seems to work fine in sbcl, clisp, ecl, openmcl, gcl and cmucl. And with ECL maxima seems to build fine, as well. But when I start a maxima that was compiled with ECL it generates a runtime error that the variables share-subdirs defines are not bound.
ECL (and I'd suspect GCL has a similar problem) does not have image save utility. That means there is no such thing as save-lisp-and-die, so all alterations to the system (i.e from repl) at runtime are not part of the final executable.
When building executables ECL compiles all files in a system definition and (optionally) produces a single executable composed of these objects. Your compilation may depend on some parameters and if you define them from REPL, they will be available during build time, but if you start the executable you start with bare Common Lisp and then you add all things which are part of compiled files. If your files are only loaded during compilation, then they are not in the "bare" image when you start the executable. So if your application depends on some parameters, they must be defined in one of your compiled components (or their dependencies).
Best regards, Daniel
ECL (and I'd suspect GCL has a similar problem) does not have image save utility. That means there is no such thing as save-lisp-and-die, so all alterations to the system (i.e from repl) at runtime are not part of the final executable.
When building executables ECL compiles all files in a system definition and (optionally) produces a single executable composed of these objects. Your compilation may depend on some parameters and if you define them from REPL, they will be available during build time, but if you start the executable you start with bare Common Lisp and then you add all things which are part of compiled files. If your files are only loaded during compilation, then they are not in the "bare" image when you start the executable. So if your application depends on some parameters, they must be defined in one of your compiled components (or their dependencies).
But I added a
#-ecl :load-only #-ecl t
Doesn't that make the component compiled on ECL?
Sorry for asking such a basic question.
If I copy the file to the source tree and change the ":private-file" to an ":file" everything builds and runs fine.
Kind regards,
Gunter.