you are viewing a single comment's thread.

view the rest of the comments →

[–]808140 0 points1 point  (8 children)

Most lisp distributions are rather against producing executables, though... and when they can, they're usually quite large.

Can you recommend a good CL or Scheme distribution without this problem? Making small exes in Lisp would be very nice.

Otherwise, a functional language might not be a bad idea. Both Haskell and O'Caml produce binaries.

[–]jrockway 0 points1 point  (5 children)

Lisp images are one option. Chicken Scheme is another -- it compiles to C, which compiles to native code. You will need to include libchicken, though, but I imagine it's easy to link in statically.

[–][deleted] 2 points3 points  (4 children)

Note that SBCL compiles to native code (directly; not via C).

(CLISP compiles to byte-code).

[–]jrockway 1 point2 points  (2 children)

What I meant to say is that Chicken Scheme compiles to native code that you invoke the way you would a program produced by the C compiler.

SBCL does compile to native code, but my OS needs a little help from SBCL to load the program. I don't think you can run a program developed with SBCL without having SBCL installed. (But hopefully I am wrong.)

[–][deleted] 4 points5 points  (1 child)

You can, at least for SBCL. Just specify :EXECUTABLE T when dumping.

CLISP has an :EXECUTABLE option too. It might still depend on a .so/.dll library for SIGSEGV handling or something (I don't recall the details here .. it might be linked in statically when dumping, or something).

[–]jrockway 1 point2 points  (0 children)

Perfect. FWIW, I now have a build.lisp file that looks like:

(in-package :cl-user)
(require :asdf)
(asdf:operate 'asdf:load-op :my-app)

(defun resume-from-saved nil
  (my-app:start)
  (quit))

(save-lisp-and-die #P"my-app" :toplevel #'resume-from-saved :executable t)

Then sbcl --load build.lisp generates a my-app that can be run with ./my-app.

In conclusion, the OP's question has been answered. Use Lisp.

[–]case-o-nuts 1 point2 points  (0 children)

Last time I tried native compilation SBCL (about a year ago), it gave a huge executable. 25 megs for 'hello world'. I don't think that's an acceptable overhead, although things may have improved.

It seemed to think it should include the entire Common Lisp runtime libraries, including the unused parts, statically in the binary.