As a confidence boosting step towards compiling CogVM on my new Slackware64 architecture using the compatibility libraries I have been taking ‘baby steps’. I figured a good one would be to compile a VM that compiles natively on a 64 bit machine without the need for compatibility libraries.
I did it.
Woot!
Here’s how.
go to http://squeakvm.org/squeak64/dist3/
There is a binary for IA64 architecture: Squeak64-3.8a-2.ia64-linux-gnu.tar.gz, but running tar -tf on it shows an ‘install’ script that I don’t want to use on my new slackware distribution. So, I ignored it and went straight to the source code.
I downloaded two files:Squeak-3.8a-2.src.tar.gz Squeak64-3.8g-6548.image.tar.gz
The first contains an image and changes file that the vm will run and the second is the source code for the VM.
You can see the contents for the first with the tar command
tar -tf Squeak64-3.8g-6548.image.tar.gz
Squeak64-3.8g-6548.image
Squeak64-3.8g-6548.changes
I left that alone until the compile was done.
I extracted the source:
tar -xvf Squeak-3.8a-2.src.tar.gz
Then cd into the new directory and run the make command, telling it to compile for a 64 bit computer.
cd /squeak64/merge64/
make WIDTH=64
On the first, attempt, I got the following error.
In file included from /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/vm/debug.c:3:0:
/usr/include/stdio.h:417:66: error: macro "dprintf" passed 3 arguments, but takes just 1
/home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/vm/debug.c: In function '__sq_assert':
/home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/vm/debug.c:21:3: warning: incompatible implicit declaration of built-in function 'abort'
make[2]: *** [debug.o] Error 1
make[1]: *** [vm/vm.a] Error 2
make[1]: Leaving directory `/home/wm/usr/src/smalltalk/squeak64/merge64/bld64'
make: *** [all] Error 2
On the inter-webs, I did a search for ‘error: macro “dprintf” passed 3 arguments, but takes just 1’
It seems there is a naming conflict between something in the VM source code and the dprintf declaration in stdio.h. The above steps work around that
I found this solution (somewhere):
cp /usr/include/stdio.h /platforms/unix/vm/stdio.h
Then vi /platforms/unix/vm/stdio.h and delete dprintf definition… (ugly but works)
then vi /platforms/unix/vm/debug.c and substitute #include by #include “stdio.h”
And you’ll compile clean.
I did as they said and re-ran make WIDTH=64
and it did.
The build creates a directory bld64 which looks like this:
bld64/
|-- B2DPlugin
| |-- B2DPlugin.a
| |-- B2DPlugin.o
| `-- Makefile
|-- BitBltPlugin
| |-- BitBltPlugin.a
| |-- BitBltPlugin.o
| `-- Makefile
|-- FilePlugin
| |-- FilePlugin.a
| |-- FilePlugin.o
| |-- Makefile
| |-- sqFilePluginBasicPrims.o
| `-- sqUnixFile.o
|-- Makefile
|-- Mpeg3Plugin.sub
|-- SocketPlugin
| |-- Makefile
| |-- SocketPlugin.a
| |-- SocketPlugin.o
| `-- sqUnixSocket.o
|-- SqueakFFIPrims.lib
|-- XDisplayControlPlugin.lib
|-- config.h
|-- config.log
|-- config.sh
|-- config.status
|-- disabledPlugins.c
|-- disabledPlugins.o
|-- inisqueak
|-- libtool
|-- make.cfg
|-- make.ext
|-- make.int
|-- make.prg
|-- make.targets
|-- mkconfig
|-- nps
| |-- Makefile -> /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/npsqueak/Makefile
| |-- README.npsqueak -> /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/npsqueak/README.npsqueak
| |-- include -> /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/npsqueak/include
| |-- npsqueak.c -> /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/npsqueak/npsqueak.c
| |-- npsqueak.o
| |-- npsqueak.so
| |-- npsqueakregister.in -> /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/npsqueak/npsqueakregister.in
| |-- npsqueakrun
| |-- npsqueakrun.in -> /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/npsqueak/npsqueakrun.in
| |-- npunix.c -> /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/npsqueak/npunix.c
| |-- npunix.o
| `-- test -> /home/wm/usr/src/smalltalk/squeak64/merge64/platforms/unix/npsqueak/test
|-- plugins.exc
|-- squeak
|-- squeak.1
|-- version.c
|-- version.o
|-- vm
| |-- Makefile
| |-- aio.o
| |-- debug.o
| |-- gnu-interp.c
| |-- gnu-interp.o
| |-- osExports.o
| |-- sqNamedPrims.o
| |-- sqUnixCharConv.o
| |-- sqUnixExternalPrims.o
| |-- sqUnixMain.o
| |-- sqUnixMemory.o
| |-- sqVirtualMachine.o
| `-- vm.a
|-- vm-display-X11
| |-- Makefile
| |-- sqUnixMozilla.lo
| |-- sqUnixMozilla.o -> sqUnixMozilla.lo
| |-- sqUnixX11.lo
| |-- sqUnixX11.o -> sqUnixX11.lo
| `-- vm-display-X11.la
|-- vm-display-fbdev
| |-- Makefile
| |-- sqUnixFBDev.lo
| |-- sqUnixFBDev.o -> sqUnixFBDev.lo
| `-- vm-display-fbdev.la
|-- vm-display-null
| |-- Makefile
| |-- sqUnixDisplayNull.lo
| |-- sqUnixDisplayNull.o -> sqUnixDisplayNull.lo
| `-- vm-display-null.la
|-- vm-sound-OSS
| |-- Makefile
| |-- sqUnixSoundOSS.lo
| |-- sqUnixSoundOSS.o -> sqUnixSoundOSS.lo
| `-- vm-sound-OSS.la
`-- vm-sound-null
|-- Makefile
|-- sqUnixSoundNull.lo
|-- sqUnixSoundNull.o -> sqUnixSoundNull.lo
`-- vm-sound-null.la
13 directories, 83 files
I then took the Squeak64-3.8g-6548.image and Squeak64-3.8g-6548.changes file and moved them to the bld64 folder.
Then, from the bash prompt, run
bash-4.1$ ./squeak Squeak64-3.8g-6548.image
and voila!
Further work will be around organizing the layout of my new ‘distribution’. What I am intuiting, is that when I look at a standard squeak distro and see Contents and Resources and Plugins etc, I am seeing the tools used to create the VM? I need to answer these questions for myself.
Anyway, 64Bit Squeak image on a 64 Bit VM compiled on Slackware 64 is (semi) done.
Next up is standard 32 bit squeak on Slackware 64 followed by Cog.
Leave a comment