Wednesday, March 10, 2010

How I build squeak vm on (Arch)Linux

I write this post as a memento for me. I will appreciate some feedback on building the VM on other Linux distro.

1. Prepare a working directory

All the work will take place in ~/squeakvm (/home/lol/squeakvm on my machine):

mkdir ~/squeakvm
cd ~/squeakvm

2. Get squeak-vm source

The easiest part. The VM source code tarball can be found on At the time of writing, the last stable version is 3.11-3.2135. Go and get it:

tar -xvzf Squeak-

3. Load VMMaker tool

For more explanations on why VMMaker is needed and how it works, here is a good overview.

To generate the source code for your own VM, you need a running Pharo image. Here I use a fresh Pharo 1.0-10508 rc2 image from Pharo website.

Open your image, then load VMMaker by evaluating this in a Workspace:

Gofer new
 squeaksource: 'MetacelloRepository';
 package: 'ConfigurationOfVMMaker';
(Smalltalk at:#ConfigurationOfVMMaker) project lastVersion load.

4. Load FT2Plugin

UPDATE: Should not be necessary now. See Javier's comment.

To display anti-aliased font of Pharo images, you need the FT2Plugin. To load it:

 user: ''
 password: ''.

 location: ''
 user: ''
 password: ''.

5. Configure VMMaker and generate the VM source

Now you can open VMMakerTool:

VMMakerTool openInWorld

In the Path to platforms field put the path to the extracted Squeak VM tarball: ~/squeakvm/Squeak-

Then right-click on one of the plugins pane and select make all external for a simple configuration.

Note you can have a description of each plugin by reading the class comment.Classes are part of VMMaker-Plugins category.

In path to generated source select a directory where the VM source will be written. Here ~/squeakvm/src32.

The VMMakerTool window should look like this:

Then click on the Entire button (top-left of window). Wait a moment, pray, and the code should be generated.

Finally, I replace the original VM source with the generated one.

rm -rf ~/squeakvm/Squeak-
cp -a ~/squeakvm/src32 ~/squeakvm/Squeak-

Note: theorically this should not be necessary as the configure script accepts an option to specify the source directory path, but it doesn't seem to work.

6. Build the VM

First create a directory for the build and go in:

mkdir ~/squeakvm/Squeak-
cd ~/squeakvm/Squeak-

Then run the configure script


First problem. I have this error:

CMake Warning (dev) in 
  Syntax error in cmake code when parsing string


  syntax error, unexpected cal_SYMBOL, expecting } (21)

Thanks to this mail there's a patch to correct it.

cd ~/squeakvm/Squeak-
patch -p0 < Plugins.cmake.patch
Then clean and run the configure script again
cd ~/squeakvm/Squeak-
rm -rf *
You should have the Makefile now. Run make:
Then another problem as libfreetype (needed by FT2Plugin) is not found. To correct it, create config.cmake for FT2Plugin this way:
mkdir ~/squeakvm/Squeak-
echo "PLUGIN_FIND_LIBRARY(FT2 freetype)" > 
More informations on this error here.

UPDATE: See Javier's comment.

Clean and run make again:
make clean
Then install:
sudo make install
7. Conclusion
The process is not so easy. To help I put all the squeakvm directory (with sources, pharo image with vmmaker) on

UPDATE: Good post for MacOSX