alvatar
alvatar

Reputation: 3380

Is it possible to deploy a Common Lisp (or other dialect) desktop application for several platforms?

I would like to develop a graphical application in Common Lisp or other Lisp dialect that could be deployed in Mac, Windows and Linux as a way of improving my knowledge of this language. Ideally:

  1. would compile the code
  2. would use a common graphical library
  3. wouldn't need installation of the runtime environment.

I would like to make a little game or graphical app, and to be able to show it with a simple installation in a computer with any of these operating systems.

Someone has experience with similar situations or could point me to best choices of graphical libraries and compilers, runtime environments, etc...

Thanks!

Upvotes: 15

Views: 4153

Answers (7)

lev
lev

Reputation: 11

Ecl lisp can compile very small executable (a few kbs) but on Ubuntu in order to execute this executable file there must be libecl.so.11.1 file in your /usr/local/lib directory. This file is 5.7 mb.

Upvotes: 1

Julian Squires
Julian Squires

Reputation: 437

What I'm doing presently, for a graphical application that uses OpenGL and GLFW, is developing primarily with SBCL, and giving my testers deliveries via cl-launch. However, my plan is to use CCL to build an application bundle on OS X, and ECL to build a stand-alone executable on Linux and Windows. The bundles I'm building at the moment with cl-launch are fairly large (typically 30M and up), while the tests I've done with ECL have been much smaller (libecl weighs in at about 1.3M on my system). However, I would expect SBCL to perform better (though I'd profile to make sure, first!), so your choice will depend on your application.

However, if I were doing this commercially, I would invest in one of the commercial implementations. Rainer Joswig mentions LispWorks and Allegro above. For Windows app delivery, you can also consider Corman Lisp. My impression is that the fastest but most expensive route to doing application delivery across those three OSes is to buy Allegro, but an alternative (more work, but cheaper) would be to use CCL on OS X, Corman on Win32, and ECL or SBCL on Linux. LispWorks seems to be a choice in between, although many people swear by it, so I wouldn't discount it as inferior to Allegro just because it's more affordable.

The graphics library issue is something separate; my impression is that the situation is constantly improving (callbacks in CFFI seem to work on most platforms now, which is a big help in interfacing to most C toolkits), but I've been working more with GL, GLFW, GLUT, and SDL (though not yet with lispbuilder, mentioned by justinhj above, which looks cool). I did experiment a little with wxCL a year or two ago, and it seemed promising.

The nice thing about CL is that, with so many good implementations, you can develop in your implementation of choice, and most of your code should be easily ported to whichever implementation you choose for application delivery on a given platform.

Upvotes: 3

justinhj
justinhj

Reputation: 11316

I'm one of the developers of lispbuilder-sdl which is currently hosted on google code.

alt text http://img10.imageshack.us/img10/7664/mandelbrot.jpg

http://code.google.com/p/lispbuilder/

This gives you a way of running common lisp programs on linux, windows and mac machines without modification. We use the SDL library and various extensions of it.

A minimal program looks like this:

(sdl:with-init ()
  (sdl:window 320 240)
  (sdl:draw-surface (load-image "lisp.bmp"))
    (sdl:with-events ()
      (:quit-event () t)
      (:video-expose-event (sdl:update-display))))

The wiki also explains how to build self contained exe's for various of the common lisp implementations.

Upvotes: 19

Svante
Svante

Reputation: 51531

There is ECL, a Common Lisp implementation that seems to do what you want (I have not used it yet, though).

Upvotes: 1

Steven Huwig
Steven Huwig

Reputation: 20794

PLT Scheme can do all that you ask. The library it uses out of the box is WxWindows, but you can get bindings for other GUI systems if you really want to.

PLT Scheme is probably the Lisp with the most work done on making it easy to write and distribute "a little game or graphical app." They include many examples of games in the base distribution and their flagship IDE DrScheme is written in their own graphics framework. It is free to create and distribute compiled PLT Scheme code on any platform.

Edit: You asked for any Lisp dialect. Would Clojure also be an option?

Edit 2:

You said that Clojure is an option. If you are already very familiar with Java and Swing, I think that Clojure would be a good way to go -- with the caveat that it's got some pretty big syntactic differences with other Lisps. A book is forthcoming.

If you aren't already a Java expert, I think PLT Scheme would still be the best choice. I am coming at this from the "just beginning to learn Lisp" and "small demo application" angles. Other people have noted that commercial Common Lisp implementations support what you want, but those will be harder (and more expensive) to use as introductory systems.

All of these implementations have macro systems, which I think is what you mean by "code is first-class."

Upvotes: 6

simon
simon

Reputation: 7022

Rainer has a good comment on the fundamental issues: There are good commercial solutions doing exactly what you ask (but they are not free development environments, and may involve recurring fees), with well supported cross-platform libraries. There are also free software approaches, but it is more difficult to deliver on all three platforms as you require (not impossible, but more fiddling about).

I will add though that "not installing the runtime environment" is a bit problematic. You certainly don't need to have the end-user separately install a lisp, but your program may well need to essentially install the entire runtime in order to work, depending on what you do. The flexibility at this level means it can be difficult to programatically determine what bits are and are not needed, which is why the free software solutions usually don't bother with the somewhat tedious and tricky work of writing a tree shaker to do this.

Upvotes: 4

Rainer Joswig
Rainer Joswig

Reputation: 139391

Most Common Lisp implementations can dump executable images. Sometimes these are two files (kernel + image), but often this can be just one executable. But the executable usually runs only on the platform it was compiled for. Commercial implementations like LispWorks or Allegro CL have extended capabilities - for example one can remove unused parts of the Lisp system. This is called 'delivery'.

There is some information about LispWorks applications. LispWorks is commercial and covering platforms can be expensive. You would have to buy the development environment - delivery is free on popular platforms. LispWorks has a graphical library for Windows, Mac and Unix/Linux. The latter is based on the oldish Motif. The advantage is that the code can be very portable over platforms. The LispWorks development environment itself is a LispWorks application. On the Mac for example the 32bit version and the 64bit version runs on both PowerPC and x86 from a single application.

Information about 'free' versions of Common Lisp and libraries is collected on CLIKI. Writing MS Windows applications is not the strongest part of 'free' Common Lisp, though.

Upvotes: 9

Related Questions