Building GNU Smalltalk on Mac OS X Snow Leopard

Recently I wanted to dust off some old code I’d written for GNU Smalltalk, and found that Homebrew’s formula for it didn’t build cleanly in 64-bit mode, and wouldn’t include LibSDL or Cairo support in 32-bit mode. So I rolled up my sleeves and checked out the git repository. UPDATE: I’ve updated the Homebrew formula in my fork of Homebrew; see below.

It turned out to be straightforward, after I made a few false starts. Here’s how I got it built and working, including SDL and Cairo support.

Prerequisites

GNU Smalltalk, when built from Git, depends on libffi and libsigsegv. Fortunately, Homebrew’s formulas for these work well:

$ brew install libffi
$ brew install libsigsegv
GNU Smalltalk itself

Check the code out from Git:

$ git clone https://github.com/bonzini/smalltalk.git smalltalk
$ cd smalltalk

If you’re on Snow Leopard, you’ll have autoconf version 2.61 and automake version 1.10. The GNU Smalltalk source code requests newer versions of these tools, but will build just fine with the versions shipped with Snow Leopard’s XCode. Edit configure.ac so that it has the line AC_PREREQ(2.61) instead of AC_PREREQ(2.63), and edit Makefile.am so that it has the line AUTOMAKE_OPTIONS = gnu 1.10.

(These changes are summarised in this patch.)

Once configure.ac and Makefile.am have been edited, carry on as you usually would for an autotools project:

$ autoreconf -fvi
$ ./configure --prefix=/opt/gnu-smalltalk PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.9/lib/pkgconfig
$ make
$ make install

The PKG_CONFIG_PATH variable definition on the ./configure line is necessary to let GNU Smalltalk’s configuration script find libffi, which is a keg-only Homebrew formula for Snow Leopard.

Updated Homebrew

2 Oct: I’ve just updated the Homebrew gnu-smalltalk formula to follow the steps above. It now builds from git HEAD rather than from a numbered release. My changes haven’t been accepted into the main branch of Homebrew yet, but for now you can see my formula here.

Comments (closed)
Jon 17:15, 2 Oct 2011

Don't work for me unfortunately. I get ld: symbol(s) not found for architecture x86_64 messages for either libffi or libiconv depending on whether I have /opt/local or /usr/local first in my DYLD_LIBRARY_PATH. 

Tony Garnock-Jones 18:50, 2 Oct 2011 (in reply to this comment)

That you have /opt/local at all sounds like you might have a Macports installation as well as a Homebrew installation - in which case all bets are off! You might be able to fix it by finding out which of libffi or libiconv is missing from Homebrew, installing that using `brew`, and retrying (with /usr/local first in DYLD_LIBRARY_PATH). Alternatively (and it's the option I took, long ago now), ditch Macports...

Jon 13:35, 3 Oct 2011

Thanks for the pointers, will give it a go.

sbfaulkner 09:14, 22 Sep 2012

Tried brewing smalltalk recently with no success. We're your changes ever integrated? Also, have you tried this more recently on either Lion or Mountain Lion?

Thanks

Tony Garnock-Jones 16:58, 15 Oct 2012

From eyeballing the current state of the formula, it looks like they have been integrated, but I haven't actually tried it out yet. I am still on OS X 10.6 so haven't tried it on Lion or newer. What kind of failure did you notice?