Building Squeak for the gumstix

Squeak is a Smalltalk interpreter that runs on a variety of platforms, including linux. Out of the box, it builds fine if you have a self hosted environment. For my gumstix, I'm using a cross compiler, and I don't have X Windows support, so I needed to modify the build process slightly.

Self Hosted Build

  • Download the squeak tarball.
  • Unpack it
  • Perform these steps:
    cd Squeak-3.6-3 (or whatever version you're using)
    mkdir bld
    cd bld
    su -c 'make install'

Building with buildroot

I put together a buildroot package. Create a directory call squeak inside the gumstix-buildroot/packages directory, and then copy all of the files from into it. Edit the packages/ file and add the following line:

     source "package/squeak/"
The packages are in alphabetical order, so I placed it just before the entry for sqlite. In the event that the website is down, I put a copy of the squeak tarball over here. Copy it into gumstix-buildroot/dl.

Testing squeak

The buildroot makefile will create the following files on the gumstix filesystem:
     /usr/bin/squeak (symlink to /usr/lib/squeak/3.6-3/squeak)
Copy and headlessTest.image onto the gumstix. Run the file, and it should exit shortly, creating a file imageReport.txt. If everything was successful, then the imageReport.txt file will contain "If you can read this, Squeak is working!"

Cross Compiler Build

Using the cross compiler requires some changes to the configure script, since it assumes that it can compile some C code and execute the resulting code. The simple way to do this is to create a modified script.

IMPORTANT NOTE: The steps below work for the gumstix. I determined what to do by taking the snippets of code that configure tries to use and I manually cross-compiled and executed them on the gumstix to verify what was going to happen.

  • If you don't have autoconf version 2.5 or newer, then download it, build it and install it. I used 2.57 since that was the version used to create the configure script that came with 3.6-3. I found older versions of autoconf here.
  • Change to the directory containing
         cd Squeak-3.6-3/platforms/unix/config
  • Copy to and replace the following lines in
         AC_REQUIRE_SIZEOF(int,    4)
         AC_REQUIRE_SIZEOF(time_t, 4)
         AC_REQUIRE_SIZEOF(double, 8)
         #AC_REQUIRE_SIZEOF(int,    4)
         #AC_REQUIRE_SIZEOF(time_t, 4)
         #AC_REQUIRE_SIZEOF(double, 8)
         SQUEAK_INT64_T="long long"
         AC_DEFINE_UNQUOTED(squeakInt64, long long)
    Comment out these two lines:
    and add the AC_DEFINE to become:
    Change this line:
         disabled_plugins="vm-display-fbdev SqueakFFIPrims"
  • We need to make one minor tweak to Find these lines:
         $(squeak) : $(SQLIBS) version.o
                 $(LINK) $(squeak) $(SQLIBS) version.o $(LIBS) [plibs] vm/vm.a
                 @size $(squeak)
                 @./$(squeak) -version
    and comment out the last two lines. Trying to execute squeak will fail since it's been built for the ARM rather than the native platform. Commenting out the call to squeak allows the rest of the build process to continue.
         $(squeak) : $(SQLIBS) version.o
                 $(LINK) $(squeak) $(SQLIBS) version.o $(LIBS) [plibs] vm/vm.a
                 @size $(squeak)
                 #@./$(squeak) -version
  • Setup the plugins:
        ./mkacinc > acplugins.m4
        autoconf -o configure-gumstix
        rm acplugins.m4
  • Fix some source files. Recent versions of uClibc add a function prototype for a function called clone. This conflicts with a function called clone in the squeak sources. In the src/vm/interp.c file replace all occurences of clone with sq_clone. In platforms/Cross/vm/sqVirtualMachine.c, replace all occurences of clone with sq_clone except for this one: "VM->clone".
  • Make sure that arm-linux-uclibc-gcc is in your path. I added /home/dhylands/gumstix/gumstix-buildroot/build_arm/staging_dir/bin to my path. For whatever reason, I had to use a fully qualified path and couldn't use one with ~ in it or make wouldn't recognize it.
  • Now run the configure-gumstix script. Note the --no-builtin-xxx stuff was needed with version 0.9.27 of uClibc and may or may not be needed with newer versions. Without these, I got linker errors about expf, sinf, and cosf all being missing functions.
         cd ../../..   (into the Squeak-3.6-3 directory)
         mkdir bld-gumstix
         cd bld-gumstix
         CC=arm-linux-uclibc-gcc CFLAGS='--no-builtin-exp --no-builtin-cos --no-builtin-sin -O3' \
             ../platforms/unix/config/configure-gumstix --without-x --without-npsqueak \
             --without-rfb --without-ffi --host=arm-linux --prefix=/usr/squeak
         su -c 'make install'
  • copy all of the files from /usr/squeak/lib/squeak/3.6-3/ onto the gumstix. Due to the size, you'll need to use an MMC card, since there's only about 1.2 Mb of free space in the flash image on the gumstix.

I discovered that with gcc 3.4.2 that not all of the optimization flags were capable of producing working VMs. Here's a small table that shows what I observed:
Executable Size
The entries with - in them all failed due to an illegal instruction. The bytecodes/sec and sends/sec came from tinyBenchmark.

Home - linux - gumstix

Copyright 2007 by Dave Hylands