Dabbling with Clozure CL

qr-code for this page's url

Yesterday Rainer Joswig twittered about using Clozure CL on the Raspberry Pi. So, instead of delving more into ECL I tried installing that as well.

Currently you should get the trunk version not the released 1.8 version as the support for ARM6 is only fairly recent.

$ svn co http://svn.clozure.com/publicsvn/openmcl/trunk/linuxarm/ccl ccl-trunk.svn
$ cd ccl-trunk.svn

The checked out code even contain a read-made binary. But be aware that that binary is built for linux distros with soft float. The Raspbian distro that I have installed uses hard float (more efficient) and that causes weird results:

$ ./armcl
? (sin 1.0)

Which is correct only for very generous error bars.

Re-building a correct version is quite easy.

$ cd lisp-kernel/linuxarm/
$ $EDITOR float_abi.mk # Change to hard float
$ make clean
$ make

After that we are good to build our hello world app:

$ cd ../..
$ ./armcl
? (defun hello-world () (format t "Hello world!~%"))
? (save-application "hello-world-ccl" :toplevel-function 'hello-world :prepend-kernel t)

$ ls -l hello-world-ccl
-rwxr-xr-x 1 pi pi 33882128 Aug 4 21:16 hello-world-ccl*
$ ./hello-world-ccl
Hello world!
$ time ./hello-world-ccl > /dev/null

real 0m0.239s
user 0m0.040s
sys 0m0.190s

So we now have speedier compilation, fast startup times but large binaries.

Update: Rainer Joswig has a much nicer write-up of this.