|
[ | home | | | download/install | | | problems/bugs | | | developers | | | archives | | | goodies | | | resources | | | site stats | | | more stats | ] |
1. Building the Virtual Machine from Source Code |
Note: These instructions were updated in November 2011 (with many thanks to David Lewis). The old version of this page can be found here.
In the following text the terminal prompt is in
red,
commands you type are in black, and responses printed by the machine are in
blue. The portion of the prompt between ":" and ">" indicates the current working directory, relative to "~
" which is the directory you choose to start in.
1.1. Preparing the image |
Start with a fresh image such as http://ftp.squeak.org/4.3alpha/Squeak4.3gamma-11793.zip (any recent Squeak image will do).
Open a new Morphic project in which to work, and enter the project.
Open a new workspace for taking notes as you work, and a transcript to display any transcript output that might appear.
Open a Monticello browser.
In the Monticello browser, add a new repository (+Repository button). Select "HTTP" repository type, and edit the repository information as follows:
Open the new repository (select the new entry and click the Open button to get a new repository browser).MCHttpRepository location: 'http://source.squeak.org/VMMaker' user: '' password: ''
In the repository browser, select category "update" from the list in the left panel, and select the top entry in the right panel (update-dtl.9.mcm as of this writing).
Click the "Load" button to load VMMaker. This will load VMMaker and various related packages and plugins. This will load a base version of these packages (but you do not yet have the latest updates, see the next step below). You can see a version identification for your VMMaker package by evaluating "VMMaker versionString" in your workspace:
In the workspace, evaluate the expression "VMMaker updateFromServer". This will update VMMaker and the other packages to the most up to date versions. During the merge process, a merge browser will open with a label such as "Merging FFI-Pools-eem.3". Highlight the entries and click "Keep", then click the "Merge" button to accept the merge and proceed (this merge conflict will not effect your VM, so it is safe to ignore it and proceed).VMMaker versionString ==> '4.7.9'
When the update process is complete, you will have the latest VMMaker version:
Save your image. Your image is now prepared for VM code generation, so the next step will be to load the platform source code that is required for code generation and VM building.VMMaker versionString ==> '4.7.14'
1.2. Loading the platform source code |
In a Linux terminal window (outside of Squeak), change your directory to your working Squeak directory (the same directory that you are using to run your image).
Check out an up to date copy of the platforms source code. You will need to have Subversion installed on your Linux system:unix:~> cd squeak/Squeak4.3 unix:~/squeak/Squeak4.3>
This will place all of the platform sources in a subdirectory called trunk/platforms. It is easier for VMMaker to find this directory if the platforms directory is in directly in your Squeak directory, so use a symbolic link to make it so:unix:~/squeak/Squeak4.3> svn co http://squeakvm.org/svn/squeak/trunk ... lots of messages ... Checked out revision 2515.
The platforms sources are now ready for use, so return to your Squeak image to generate your VM source code.unix:~/squeak/Squeak4.3> ln -s trunk/platforms platforms
1.3. Generating the VM source code |
Open a VMMaker tool with world menu -> open... -> VMMaker
Click the Help button and have a quick look at the help information. You can come back to it later to read in more detail.
A list of available plugins appears in the left panel ("Plugins not built"). You can drag entiries from this panel into the "Internal Plugins" panel or the "External Plugins" panel, or you can right click on the panel and use the menu to copy all plugins from one panel to another (plugins that cannot be built on your platform will remain in the "Plugins not built" panel).
We are building our first VM, so we will select just a few important plugins to build and omit many others for now. After you are confident that you can build a VM, you can add other plugins and any operating system libraries that may be needed to support them. You can also use a VMMaker configuration file to load a saved configuration, but for now we will do the work by hand to show how it is done.
Use the mouse to drag and drop the following plugin entries from the "Plugins not built" panel to the "Internal plugins" panel.
Now add some external plugins by dragging the following entries to the "External plugins" panel:BalloonEnginePlugin BitBltSimulation DeflatePlugin FilePlugin LargeIntegersPlugin LocalePlugin SecurityPlugin SocketPlugin
Click the "Clean out" button to make sure the output directory is empty. This is not really necessary now, but it is good practice, and you will want to do it any time you want to guarantee that you are generating a complete fresh copy of the VM sources.UUIDPlugin UnixAioPlugin UnixOSProcessPlugin XDisplayControlPlugin
In the "Generate:" panel, click the "Entire" button. This will generate all of the VM and plugin source code. In other words, it will translate the Smalltalk classes in your image into C code, and store the resulting source code in the "src" directory in your Squeak directory. This generated source, in combination with the platforms source code that you downloaded from the Subversion repository, is the complete source code for your new Squeak VM. Now go back to your Linux terminal window to compile and install the VM.
1.4. Compiling and installing the VM |
You will need to have the CMake package installed on your Linux system, so make sure this is done before proceeding.
You should now have all necessary sources in the "platforms" and "src" directories in your Squeak working directory:
Create a "build" directory for building the VM, and change into that directory:unix:~/squeak/Squeak4.3> ls -ltd platforms src drwxr-xr-x 4 lewis users 4096 2011-11-19 10:10 src lrwxrwxrwx 1 lewis users 15 2011-11-19 09:39 platforms -> trunk/platforms
We will first run a configuration procedure that uses CMake to configure the sources for your system. You will find documention for this in platforms/unix/README.CMake. The script that runs this procedure has built-in help, so read this first:unix:~/squeak/Squeak4.3> mkdir build unix:~/squeak/Squeak4.3> cd build unix:~/squeak/Squeak4.3/build>
Now, from your empty build directory, run the actual configuration process. The parameters specify the location of the generated sources, and also specify that GL libaries should be avoided (they are not needed for this simple build, and might cause problems if you do not have the necessary libraries in place). If you are using a 64-bit operating system, this configuration will build a 64-bit VM (see the configuration help above if you want to specify CFLAGS to build a 32-bit VM, which you may later want to do if you are building some of the plugins that work in 32-bit mode).unix:~/squeak/Squeak4.3/build> ../platforms/unix/cmake/configure –help
When the configuration is complete, use make to build the VM:unix:~/squeak/Squeak4.3/build> ../platforms/unix/cmake/configure –src=../src –without-gl
If you have any errors or problems with the build, you may need to do some troubleshooting. In most cases the problem will relate to missing development software that you will need to install on your Linux system.unix:~/squeak/Squeak4.3/build> make
When the build is complete, your new VM is read to be installed.
Depending on the security settings of your system, you may need to log in as root (or use sudo) to perform this last step (but never use root access for any of the other build steps described above).unix:~/squeak/Squeak4.3/build> make install
Your new Squeak VM is now built and installed, ready to be run as /usr/local/bin/squeak. You can verify the version of the VM you are running as follows:
unix:~/squeak/Squeak4.3/build> squeak -version 4.7.14-2515 #1 XShm Sat Nov 19 10:27:11 EST 2011 gcc 4.5.0 Linux linux-jh8m 2.6.34.7-0.7-desktop #1 SMP PREEMPT 2010-12-13 11:13:53 +0100 x86_64 x86_64 x86_64 GNU/Linux plugin path: /usr/local/lib/squeak/4.7.14-2515 default: /usr/local/lib/squeak/4.7.14-2515/
1.5. Adding more plugins |
You will probably want to add some more plugins, and you can save and load your VMMaker configurations for various combinations of plugins with the "Load" and "Save" buttons on your VMMaker window. For reference, here is a configuration file that matches the configuration of recent official Unix Squeak VMs on www.squeakvm.org (note that you will need to locate and install KedamaPlugin and GStreamer plugin to build a VM that fully matches the standard Unix VM).
Contents of standard-vmmaker-unix.config file:
#(#(#ADPCMCodecPlugin #AsynchFilePlugin #BMPReadWriterPlugin #BalloonEnginePlugin #BitBltSimulation #CroquetPlugin #DSAPlugin #DeflatePlugin #DropPlugin #FFTPlugin #FT2Plugin #FilePlugin #FloatArrayPlugin #FloatMathPlugin #GeniePlugin #JPEGReadWriter2Plugin #JPEGReaderPlugin #JoystickTabletPlugin #KlattSynthesizerPlugin #LargeIntegersPlugin #LocalePlugin #MD5Plugin #Matrix2x3Plugin #MiscPrimitivePlugin #RandPlugin #RePlugin #SHA256Plugin #SecurityPlugin #SerialPlugin #SlangTestPlugin #SlangTestSupportPlugin #SocketPlugin #SoundCodecPlugin #SoundGenerationPlugin #SoundPlugin #StarSqueakPlugin #SurfacePlugin ) #(#B3DAcceleratorPlugin #B3DEnginePlugin #ClipboardExtendedPlugin #DBusPlugin #FFIPlugin #FileCopyPlugin #GStreamerPlugin #HostWindowPlugin #KedamaPlugin #KedamaPlugin2 #MIDIPlugin #Mpeg3Plugin #RomePlugin #UUIDPlugin #UnixAioPlugin #UnixOSProcessPlugin #XDisplayControlPlugin ) true false 'unix' 'src' 'platforms' 4 true true 'Interpreter' )
[ | home | | | download/install | | | problems/bugs | | | developers | | | archives | | | goodies | | | resources | | | site stats | | | more stats | ] |