Enjoying Open Source Software

Build SBCL on FreeBSD


Installing the binary package for SBCL on a FreeBSD 13.1 system will install version 2.2.7.

Using the SBCL from the binary package gives an error when compiling lisp programs using compression, saying that the runtime was not built with zstd support.

I wanted to see if building from source would solve this.

Build in a jail

I choose to build SBCL in a jail, so that it would not touch my system. This way I can do a kind of test-install, and if everything works fine, I can adopt it to my main system.

With ZFS creating a new jail is a piece of cake and a matter of seconds. So I setup a new jail by cloning a snapshot I made earlier from a default jail install.

Using Stow

GNU Stow is a great solution when you want to install self compiled software.

It makes installing, de-installing and upgrading software very easy.

BTW: I also use stow to manage my dotfiles.

Prepare the jail

You need SBCL to build SBCL.

In the jail I installed the binary packages git, stow, gmake, texinfo, zstd, and sbcl and created the directory /usr/local/stow/sbcl.

pkg install -y git stow gmake texinfo zstd sbcl
mkdir -p /usr/local/stow/sbcl

Now I could download and compile SBCL.

Build SBCL

git clone git://
cd sbcl
sh --fancy --prefix=/usr/local/stow/sbcl
cd ./doc/manual && gmake
cd -
setenv INSTALL_ROOT /usr/local/stow/sbcl && sh

Finish the install

Remove the binary package and use the newly compiled version:

pkg delete sbcl 
cd /usr/local/stow
stow --ignore=dir sbcl

The --ignore=dir is because of the info pages.

Starting sbcl now shows the current version:

This is SBCL, an implementation of ANSI Common Lisp

Installing on a different host

I installed quicklisp in this jail and did some test compliations.

Happy with the result, I migrated this to my main FreeBSD box:

scp -r /usr/local/stow/sbcl main-host:

At the main-host:

mv sbcl /usr/local/stow/
cd /usr/local/stow
stow --ignore=dir sbcl


Now compression works :)

For the binary that generates this website, this results in the following:

  • before compression: 23M
  • after compression: 14M

So, that is quite a lot, for small programs.

Have fun !


⇽ Set filedate on photo according to EXIF Open files with Deft in read only mode ⇾