Creating a Lisp Executable
stackoverflow.com
stackoverflow.com
> ...
> Obtaining libraries (use clbuild, LibCL, cl-librarian, asdf-install, etc. for that)
I imagine one could also use QuickLisp for libraries? ;-)
Also, what is an executable anyway? On my mac, applications are really directories with lots of stuff inside. Why insist on stuffing everything into a single file?
Lisp isn't really designed with either the standard interpreted language workflow, or the standard compiled language workflow, in mind. It's workflow is actually superior in a low of ways, but it's non-obvious to non-lispers how to make a deliverable.
Actually, it's a huge problem in some ways, as there is no standard way of delivering OSS Lisp software on Linux, or Unix systems. The few OSS Lisp projects there are usually really on the presence of a specific Lisp implementation and bundle any Lisp dependencies in themselves, which when you are familiar with how the rest of the Linux/Unix OSS community is usually packaged and delivered, feels really inefficient. One case in point is StumpWM, a Lisp based Linux window manager that gained some interest a while back. It was actually pretty neat, but there were at least three or four ways to install it and none meshed completely with whatever packaging system your distro was using. I can tell you with some certainty that that hurt its adoption compared to tiled window managers written in C.
I could go on, And deal with everything you said, but I'll stop here. It think it's suffice to say, Lisp is different and people haven't figured out how to reconcile Lisp with their expectations (right or wrong) or the rest of the world.
Actually, the executable is still a single file. The directory just contains things that would be shoved into /usr/share on Linux or into a DLL on Windows, such as the icon, metadata, any other assets (game levels, images, etc.) and runtime libraries.
lein uberjar
That'll create a standalone jar. But, of course, the computer will need some sort of JRE.This definitely reminds me of creating executables in python. Even though python really isn't a lisp it has seemingly crazy, difficult and under-developed and underutilized ways to create executables.. somewhat surprising considering how popular it is today[3].
[1] See http://clojure.org/
[2] See https://github.com/technomancy/leiningen
[3] Long list ... all have pluses and minuses http://www.py2exe.org/ http://pypi.python.org/pypi/py2app/ http://www.pyinstaller.org/ http://pypi.python.org/pypi/bbfreeze/0.97.2 http://cx-freeze.sourceforge.net/
I've been trying various approaches to this problem myself but haven't converged on the best cross platform solution yet:
* http://www.aerique.net/software/etotp/ (needs a nice index page)
* http://github.com/aerique/okra (see examples)
The Lispbuilder-SDL people have been working on this as well:
* http://code.google.com/p/lispbuilder/wiki/StandAloneExecutab...
If I could spare the money I'd try out LispWorks (you'd have to pay for each seperate platform IIRC).
I partly agree with the size considerations but only for mobile platforms. What's 20mb for a normal machine?
The only exception to this problem are VMs which are often clunky and restricted to code precompiled for a specific version of a VM. I would like to see more solutions to this dilema, examples of which can be seen in py2exe and pyinstaller, for Python.
Edit: This is a general thought, and not a dig against Lisp. It is made clear by Stack Overflow answers that many implementations of Lisp have easy ways to make executables which are well documented.
In clisp and sbcl (I do not have a lot of experience with other implementations), the "make this an executable binary" command is a one-liner, so the hoops are at least comparable to other languages.
It occurs to me that every language that has a binary deploy has extra hoops, depending upon what you want. For example, you have to make sure that you use the right flags on gcc to debug your code with debugging symbols (not the default) or use "tail call optimization". No, actually it is worse: serious C projects have large, ugly Makefiles with optimization parameters, dependent library libs specified, dependent library include paths, etc etc. It is so ugly that several systems have been written for the singular purpose of creating a Makefile just so that your little Gtk App can compile. And C is a language people consider to be a real language that compiles stuff. :)
The hoops are not limited to languages with a REPL.
csc app.scm ./app
Not really a problem with interpreted languages, it's just that it may not be as common in some worlds.