This is a read-only archive!

SBCL on Debian (sucks)

In my oh-so-neverending quest to learn Lisp and make a webpage using it, today I actually bothered trying to install SBCL on my server, which is a VPS running Debian.

Failure. I got errors like this:

mmap: Cannot allocate memory
ensure_space: failed to validate 536870912 bytes at 0x09000000
(hint: Try "ulimit -a"; maybe you should increase memory limits.)

This is a well-known error involving CMUCL and SBCL and Debian (and some other distros), especiall when running from a VPS apparently. Lots and lots and lots and lots of people have this problem, seemingly. Reading through all of that, it's hard to figure out whether it's a bug in SBCL, a bug in Debian's package, or a bug in the kernel.

Given that I'm on a VPS on someone else's server, memory and other resource caps are set and I can't touch them, so a lot of the (probably unhealthy) hacks that some people list as solutions above don't work for me.

Fortunately there's a solution posted to one of the SBCL lists. Download the SBCL source, and edit src/compiler/x86/parms.lisp, find the section for your OS and change one of the lines to read:

(def!constant dynamic-space-end         #x10000000)

Then it's a matter of recompiling SBCL. You have to do this on a machine that already has a working SBCL (or other Common Lisp) installed. The install instructions on the website are not as complete as the INSTALL that comes in the source tarball. The included INSTALL doc has some important things you need to do if you want to compile SBCL with threading enabled. (Note: You probably do want threading enabled.) If I'd read that first it would've saved me 30 minutes worth of compiling an SBCL that I couldn't use for Hunchentoot due to no threading.

Here is yet another example of where a binary distro fails and fails hard. If this was Gentoo I could've tweaked an ebuild and thrown it into an overlay and taken care of most of this bookkeeping crap for me. With Debian I get to compile everything by hand and SFTP files around between servers and look up to make sure I have install prefixes set correctly and so on and so on. With Gentoo I wouldn't have forgotten to enable threads because I'd have a USE flag right in front of my face.

In any case the above mess at least got me a working SBCL that let me install and run Hunchentoot. Time will tell whether it's going to survive when I actually start hosting a web page on it, or whether reducing SBCL's memory allocation is going to starve and kill my program.

January 26, 2008 @ 12:44 PM PST
Cateogory: Programming

1 Comment

Michael Jung
Quoth Michael Jung on February 11, 2008 @ 6:23 PM PST

Had similar problems with remote installation of sbcl on my webserver. Finally stayed with a binary install from, no problem running hunchentoot so far.