On Mon, Aug 12, 2002 at 09:14:08AM -0400, Sandro Magi wrote:
>Maybe I'm just an idiot, but I haven't been able to find a way to invoke the
>native code compiler to generate stand-alone native executables. There is no
>reference anywhere in the mailing lists, the manual, the documentation, the
>website or CLiki.
>How do you invoke the native code compiler? Thanks.
You must differentiate two things: native code and standalone code.
SBCL always compiles to native code, newer versions even implicitly
(i.e. when you #'load a .lisp source w/o file compiling it before,
or when typing in forms in the REPL). However, there's no way
to generate standalone code (i.e. a self-contained program where
you don't need the sbcl runtime binary to run).
However, "standalone"-ness isn't really a black or white property
anyway. Usually, C programs need other files to run too (things like
ld.so and the shared C standard library). So the difference is
more gradual: the sbcl runtime is installed on less machines, and
it uses a different mechanism to start up (i.e. you must do more
things manually or in a wrapper script).
The best thing to do is to use #'sb-ext:save-lisp-and-die (use
#'describe to view its documentation) to dump a core with your
application code inside, using :toplevel to specify your main
function to run. Then build a small wrapper shell script of the
exec sbcl --core /path/to/your/installed/application.core --noinform \
Distribute the sbcl binary, the wrapper script and your core file,
perhaps together with some installer that patches up the paths
in the wrapper script before installing the files. Or put those files
into a package for your favourite OS distribution (and don't bundle
sbcl if there's a sbcl package for that OS already, use package