To whom it may concern:
I managed to figure a way to include the alien.so files I needed for
an sbcl app to be deployed on a system without sbcl (or the exact fasl
compatible sbcl) installed.
I don't think this is a general solution, but it Works For Me (tm).
My app is a version of the ubiquitous "Planet" aggregation software
and is meant to be run as a command line utility with help from a
planet.sh retrieve render --config=planet.config
The planet.sh file is a bash shell script which wraps an invocation to
the sbcl runtime and core file I include in the binary app bundle.
The tarball looks something like:
and so on. As you'll see in this build script, I force the
*shared-objects* objects to use a relative path name (starting with
"./core"), which works as long as you invoke the script from within
the deployment directory. Given that this isn't (yet) meant to be
deployed as an rpm or dep where I can count on absolute paths, this
works well enough for me.
The context for this technique is based on the helpful how-to at:
The following build.lisp is also at:
Hope this helps at least someone!
;;;; -*- mode: lisp; syntax: common-lisp; -*-
(lambda (condition hook)
(declare (ignore hook))
(format *error-output* "error: ~a~%" condition)
(sb-ext:quit :unix-status 1 :recklessly-p t)))
(defun copy-file (source target-dir)
(sb-ext:run-program "/bin/cp" (list source target-dir)))
(defun save-aliens ()
(let ((aliens sb-alien::*shared-objects*))
(dolist (alien aliens)
(let* ((source (sb-alien::shared-object-file alien))
(target (concatenate 'string "./core" source)))
(copy-file source target)
(setf (sb-alien::shared-object-file alien) target)))))
(defun run ()
(cl-planet:planet-main (cdr sb-ext:*posix-argv*)))
(sb-ext:save-lisp-and-die "core/cl-planet.core" :toplevel #'run))
On Sat, 5 Mar 2005 10:44:11 +0200 (EET), Nikodemus Siivola
> On Fri, 4 Mar 2005, Keith Irwin wrote:
> > SO, is there a solution to this OTHER than installing SBCL on the host
> > machine? Could I, for instance, do something interesting just before
> > save-lisp-and-die to change that path?
> Yes, though currently it involves some low-level hackamagick; I hope
> to "some day" provide a contrib module to do this bundling (unless
> someone else does it first), but not right now.
> Look at sb-alien::*shared-objects*; it's a list of
> sb-alien::shared-object structures corresponding to the loaded shared
> objects. You need to copy all of the .so-files pointed to by these into
> your bundle, _and_ change the sb-alien::file slots of these
> structures correspondingly (the value of the file slot should be the
> unix-namestring of the pathname.) Don't touch the sap slot.
> If you're confused by this, looking at src/code/foreign-load.lisp in
> the SBCL source tree may help.
> Hope this helps,
> -- Nikodemus Schemer: "Buddha is small, clean, and serious."
> Lispnik: "Buddha is big, has hairy armpits, and laughs."