Subject: Re: compiling lisp files into executables..
From: Erik Naggum <>
Date: 1999/08/26
Newsgroups: comp.lang.lisp
Message-ID: <>

* Deepak Goel <>
| i (am a novice and) was hoping to create a stand-alone executable out of
| my lisp program.

  why?  are you going to deploy it on a matchbox-size robot or something?

  seriously, you should investigate your real need, not reach for the
  hammer because you have only seen nails so far.

| am using franz lisp. 

  that's quite impressive if true.  are you sure you are not using Franz
  Inc's Allegro Common Lisp?  I'm assuming you mean ACL 5.0.1.

| (compile-file ..) created a .fasl file which however has to be called
| from within lisp...

  well, loaded, yes.  why is that a problem?  you will hardly find any
  program that is truly standalone these days.  most of them load all kinds
  of shared libraries and use a whole lot of operating system resources,
  except they have probably concealed it so it isn't obvious to the novice.

| how do i create a stand-alone executable file?

(with-open-file (executable "whatever" :direction :output)
  (format executable "#!/bin/sh~%lisp -qq -L whatever.fasl -e '(whatever)'~%"))
(excl:run-shell-command "chmod +x whatever")

  there are more complex ways that produce image files (.dxl) and which may
  be dedicated to a particular task different from development (runtimes).
  if you have an image whatever.dxl, you can even link "lisp" to "whatever"
  and it will search for whatever.dxl first.  there is also a shared
  library that is probably needed unless the image is dumped standalone.

  none of this is going to make much sense as advise goes, however, until I
  know more about your actual need, as opposed to the perceived need for a
  stand-alone executable in a world where that is actually so uncommon that
  only the impression that it is what you get is what remains.

  fitting Lisp applications into the Unix world is pretty easy, but you
  lose about 90% of the value of Lisp applications when you do that.  if
  you actually want to increase the value of your Unix system by adding
  Lisp applications to it, you're better off turning your world upside down
  and investigating how to run Unix programs smoothly from inside your Lisp
  application.  it's almost like they do under Windows: just let your
  application (riding on top of Allegro CL) take over the whole machine --
  it's better off without the silly operating system, anyway.

  save the children: just say NO to sex with pro-lifers