VM Recipe: How to build an interpreter VM on Linux
Last updated at 12:52 pm UTC on 6 May 2020
This recipe is for compiling a V3 VM that opens V3 image format from its src and platforms C source code.
See How to build a standard VM with Squeak on Linux on how to build the latest VM that supports newer and more efficient image formats.
The VM source code is maintained in a Subversion repository hosted at http://squeakvm.org and can be downloaded using SVN client software.
An archival (possibly outdated) copy is also maintained in the current opensmalltalk-vm github repository under oldTrunk branch.
The shell script for the build instructions below is mkvm
How to build an interpreter VM (1) from source on a typical Linux or Unix system:
CAVEAT. As of 30-Oct-2019 this procedure is NOT working out of the box in FreeBSD-12.0. [NMI] .
Preparation - installing development libraries and toolchains
- Install development toolchain and libraries for your Linux system (32-bit compatibility libraries are not required).
- Install CMake, either from your Linux distribution or from www.cmake.org.
- Install Subversion, either from your Linux distribution or from https://subversion.apache.org/.
- If you also want to make a Debian install package, install the checkinstall utility.
Getting src/ and platforms/ sources
Make a new, empty, directory for your work. In that empty directory, download the full platforms sources from the Subversion
repository. Download everything, whether you need it or not. The Subversion
directory information will be used in the build process, so do not cut
corners to save space.
$ svn co http://squeakvm.org/svn/squeak/trunk/platforms
Also in the new directory, download the generated sources. This is an up to
date copy of source files generated from the Smalltalk source code in VMMaker.
You can generate them yourself by loading VMMaker, but using pre-generated files in the repo is a faster way to get started.
$ svn co http://squeakvm.org/svn/squeak/trunk/src
You will now have ./platforms and ./src directories with the latest source
code for the VM. Make another subdirectory called ./build that you will
use to build the VM.
$ mkdir build
Change to the build directory.
$ cd build
Copy the example Makefile into your build directory.
$ cp ../platforms/unix/cmake/Makefile.example Makefile
This Makefile contains a few variables to customize build paths which you edit to suit your environment. In particular, you may want to edit the O, P and S options. O is set to install the product in /usr/local and these require root permissions to install. You may choose a different path for O to avoid using root permissions. You may also choose to build in a tmpfs (e.g. /tmp/bld) that is faster and more efficient for the many small and temporary files created during the build. Set the S and P options to provide the full paths to src/ and platforms/ sources respectively, either in the Makefile or from the command line:
$ make O=/opt/squeak S=/opt/squeak/svn/trunk/src/ P=/opt/squeak/svn/trunk/platforms/
This top level make will create a subdirectory build/, populate it with configured Makefiles and then build the product. On 64-bit hosts, an extra build64 subdirectory is created to hold 64-bit binaries. Check the output for build errors and repeat make until the products are built successfully.
$ make install
You should have permissions to copy the products to the install directory specified earlier. Use sudo if necessary.
Packaging - Create a Debian package
$ make deb
You now have a VM that runs that Squeak V3 image formats, including the 64-bit version (seehttp://build.squeak.org/job/Squeak%2064-bit%20image/).
Reference: http://lists.squeakfoundation.org/pipermail/vm-dev/2015-April/018259.html by Dave Lewis. These instructions are current as of June 2016.
(1) This is a traditional context interpreter VM. It will not run the latest
high performance Spur image formats. Please refer to the Cog and Spur VM
development at Building the VM for the latest Cog and Spur VMs that support the newer image formats.