Search code examples
virtual-machinesmalltalkpharo

How do you compile a Pharo VM without an image?


I have already cloned the VM and installed all dependencies for my platform. Now I am a bit confused because a couple of guides suggests that Pharo image should be started to generate the C sources translated from Slang.

"Unix"
PharoVMBuilder buildUnix32.
"OSX"
PharoVMBuilder buildMacOSX32.
"Windows"
PharoVMBuilder buildWin32.

But how you generate a VM when you cannot start a VM in your platform? This sounds like chicken and egg problem.

This means is not possible to build a VM if you cannot start an image in that platform?


Solution

  • If you download pre-generated sources from the CI server as suggested by Esteban, you don't need the pharo-vm sources cloned from any repository. Just uncompress in a new folder and build from there.

    Assuming you have your new sources in c:\phs, open directories.cmake and rename the hardcoded path as follows:

    set(topDir "c:/phs/")
    set(buildDir "c:/phs/build")
    set(thirdpartyDir "${buildDir}/thirdparty")
    set(platformsDir "c:/phs/platforms")
    set(srcDir "c:/phs/src")
    set(srcPluginsDir "${srcDir}/plugins")
    set(srcVMDir "${srcDir}/vm")
    set(platformName "win32")
    set(targetPlatform ${platformsDir}/${platformName})
    set(crossDir "${platformsDir}/Cross")
    set(platformVMDir "${targetPlatform}/vm")
    set(outputDir "c:/phs/results")
    

    As you could not start a VM, I suppose you need to change at least the compilation flags used to generate the sources in the CI server. They are in c:\phs\build\CMakeLists.txt specially the following flags:

    • -march=... (your processor architecture, search for Safe Cflags)
    • Removing -g0 which suppress debug options
    • Remove -O2 (optimizations)
    • Remove -DNDEBUG
    • Modify -DDEBUGVM=0 to -DDEBUGVM=1

    and finally start the build script

    cd /c/phs/build
    bash build.sh