Skip to content

Instantly share code, notes, and snippets.

@tessi
Last active December 14, 2015 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tessi/5160523 to your computer and use it in GitHub Desktop.
Save tessi/5160523 to your computer and use it in GitHub Desktop.
nscogbuild script for a modern ubuntu 64bit system

How To Compile Cog VM on Ubuntu 12.10 64bit

Disclaimer: I used these instructions and the ubuntu_mvm script to build a Newspeak VM. However, this should be easily adaptable to a Squeak Cog build. It probably works on other modern linux systems, but I haven't tested any other distro. Please tell me if it does (not) work for you.

  • svn co http://www.squeakvm.org/svn/squeak/branches/Cog

    Note: git svn clone -r 2701 http://www.squeakvm.org/svn/squeak/branches/Cog didn't gave me a sane state (files missing)

  • sudo apt-get install libasound2-dev:i386

    sudo apt-get install build-essential ia32-libs gcc-multilib g++-multilib 
    libc6-i386 libc6-dev-i386 libx11-dev:i386 libbsd-dev:i386 uuid-dev:i386
    libice-dev:i386 libxext-dev:i386 mesa-common-dev:i386 libsm-dev:i386 libgl1-mesa-dev:i386
    libssl-dev:i386 libfreetype6-dev:i386 libpng12-dev:i386 libxt-dev:i386 libbsd-dev:i386

    I listed all libraries I installed while trying to make the configure checks happy. You might not need all of them.

  • download SqueakV41.sources (http://www.squeakvm.org/unix/release/SqueakV41.sources.gz)

  • put the sources in ~/Squeak/ or specify the path in the ubuntu_mvm script

  • use the ubuntu_mvm script (Ubuntu 12.10 64bit tested)

Further Reading

#!/bin/bash
# This file should be executed in an up to date Ubuntu 64bit
# It may work on other distros, but I haven't tested them.
# Place it in the nscogbuild/unixbuild/bld directory.
# We tell gcc to compile for 32bit (through -m32 option)
# We use -O1 optimization (and not -O2) see: http://forum.world.st/Getting-stable-Cog-build-on-Ubuntu-linux-td3006568.html and http://smallissimo.blogspot.de/2013/02/compiling-squeak-cog-virtual-machine-on.html
# We use the -fno-caller-saves CFLAG, see: https://code.google.com/p/cog/issues/detail?id=120
# configure your desired installation directory
INSTALLDIR=nsvmlinux
# configure the path for the squeak sources file download link for SqueakV41.sources -> http://www.squeakvm.org/unix/release/SqueakV41.sources.gz
SQUEAK_SOURCES=~/Squeak/SqueakV41.sources
echo -n "clean? [Yn]"
read a
case $a in
n|no|N|NO) echo "ok but this isn't safe!!";;
*) make reallyclean
esac
test -f config.h || ../../../platforms/unix/config/configure \
CC="gcc -m32" CXX="g++ -m32" \
--with-src=nscogsrc \
--without-vm-display-fbdev --without-npsqueak \
CFLAGS="-g -O1 -msse2 -fno-caller-saves -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DMULTIPLEBYTECODESETS=1 -DDEBUGVM=0" \
LIBS="-ldl -luuid -lpthread" \
LDFLAGS=-Wl,-z,now
../../../scripts/nukeversion
rm -rf ../../../$INSTALLDIR
make install prefix=`readlink -f \`pwd\`/../../../$INSTALLDIR`
(cd ../../../$INSTALLDIR
echo `pwd`
if [ -f squeak ]; then
mv squeak nsvm
ex -u NONE "+g/squeak/s/squeak/nsvm/g" +w +q nsvm
fi
if [ -f bin/squeak ]; then
mv bin/squeak bin/nsvm
ex -u NONE "+g/squeak/s/squeak/nsvm/g" +w +q bin/nsvm
fi
rm -rf man doc
LIBDIR="`echo lib/squeak/[0-9.-]*`"
test -f $LIBDIR/squeak && mv $LIBDIR/squeak $LIBDIR/nsvm
test -d lib/squeak && mv lib/squeak lib/nsvm
LIBDIR="`echo lib/nsvm/[0-9.-]*`"
if [ -h $SQUEAK_SOURCES ]; then
ln "`readlink $SQUEAK_SOURCES`" $LIBDIR
elif [ -f $SQUEAK_SOURCES ]; then
ln $SQUEAK_SOURCES $LIBDIR
else
echo "can't find SqueakV41.sources" 1>&2
fi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment