wiki:Documentation/BuildingStXWithRakefiles

Version 11 (modified by jan vrany, 8 years ago) ( diff )

--

This page is work-in-progress: see #89 and #90.

Building Smalltalk/X jv-branch from sources

This text describes how to compile Smalltalk/X jv-branch from sources. The same process and tools is used on SWING CI server to build Smalltalk/X jv-branch packages.

In a Nutshell

A quick guide for the impatient...

  1. Make sure you have set up a build environment as instructed
  2. Open a shell (on Linux) or command prompt (on Windows) and execute:
    hg clone https://bitbucket.org/janvrany/stx-goodies-builder-rake stx-jv
    cd stx-jv
    rake
    
  3. Go out for a short or long walk, depending on your internet connection and CPU power.

Once rake finishes (without an error, indeed) everthing should be compiled. You can then run Smalltalk/X by:

projects/smalltalk/smalltalk

or on Windows:

projects\smalltalk\smalltalk.bat

If compilation fails, please read the rest of this document. If it is still failing, feel free to ask.

Have Fun!

Setting up a Build Environment

To build a Smalltalk/X you need to have a number of tools installed and set up, such as C compiler toolchain. These tools are not needed to run Smalltalk/X once compiled.

The rest of this section gives you a detailed information on how to set up your system. Generally speaking, you need following:

  • A GCC compiler 4.7 or newer
  • GNU Make
  • Mercurial, CVS and SubVersion clients
  • Ruby 2.1 or newer
  • rake
  • JDK 7
  • Apache Ant

Windows

  • Install GNU Make, CVS and SubVersion clients. To do so, execute following in a command prompt:
    c:\msys64\usr\bin\pacman.exe -S make cvs    subversion
    
  • Install GCC toolchain. For building 64bit Smalltalk/X, install:
    c:\msys64\usr\bin\pacman.exe -S  mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL
    
    For 32bit builds, install:
    c:\msys64\usr\bin\pacman.exe -S  mingw-w64-i686-gcc mingw-w64-i686-SDL
    
    You may install both if you want to build both, 64bit and 32bit versions.
  • Install Java JDK 7 or newer. Though Oracle Java would do, we recommend using Zulu from http://www.azul.com/downloads/zulu/zulu-windows/ az Zulu 7 is recommended for use with STX:LIBJAVA on Windows. Make sure java.exe and javac.exe are in your PATH. To do so, you may use following commands:
    setx PATH "%PATH%;C:\Program Files\Zulu\zulu-7\bin"
    setx JAVA_HOME "C:\Program Files\Zulu\zulu-7"
    
  • Install Apache Ant - https://wiki.apache.org/ant/AntOnWindows. Make sure ant command is in your PATH.

This should be everything you need to compile Smalltalk/X jv-branch as described above

Linux

Debian (and derivatives such as Ubuntu or Mint)

Install following packages:

sudo aptitude install ruby mercurial cvs subversion build-essential bison flex libc6-dev gcc-multilib libx11-dev ant
sudo aptitude install ant bison flex build-essential libc6-dev libx11-dev libglib2.0-dev libwebkitgtk-dev libsoup2.4-dev libxext-dev unixodbc-dev

Following text is an old, outdated version. It's kept here for a reference until a new text is finished.

Old contents (for reference only)

Required software

Tools

  • subversion
  • cvs
  • rake (version 10.0.3 running on ruby 1.9 - it won't work with Ruby 1.8.x!!!)
  • bison
  • flex
  • ant
  • standard C toolchain (GCC, binutils, make)

Libraries - you'll need following packages together with their "dev" part (that contain C headers etc)

Debian, Ubuntu, Mint and derivates:

sudo aptitude install ant bison flex build-essential libc6-dev libx11-dev libglib2.0-dev libwebkitgtk-dev libsoup2.4-dev libxext-dev unixodbc-dev

If you're running 64bit OS, you'll need also 32bit libraries (as Smalltalks/X is currently only 32bit)

sudo aptidude install ia32-libs libc6-dev-i386 gcc-multilib

Beware, some distributions (e.g. Ubuntu 12.04) don't create needed symlinks, even when the packages are installed correctly. To fix this issue, customize and execute following commands:

sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
sudo ln -s /usr/lib/i386-linux-gnu/libXext.so.6 /usr/lib/i386-linux-gnu/libXext.so
sudo ln -s /usr/lib/i386-linux-gnu/libXinerama.so.1 /usr/lib/i386-linux-gnu/libXinerama.so
sudo ln -s /usr/lib/i386-linux-gnu/libodbc.so.1 /usr/lib/i386-linux-gnu/libodbc.so
sudo ln -s /usr/lib/i386-linux-gnu/libodbcinst.so.1 /usr/lib/i386-linux-gnu/libodbcinst.so

Fedora 14/x86_64

(thanks to Martin Kobetic)

sudo yum install glib2.i686 libX11.i686 libXext.i686 qt-webkit.i686 libsoup.i686 libX11-devel.i686

Fedora 16/x86_64

(thanks to Martin Kobetic)

sudo yum install glib2.i686 libX11-devel.i686 libXext-devel.i686 qtwebkit.i686 libsoup.i686

Note: the list of packages may not be complete, please send us an email. If something is missing, then compilation will likely fail because of missing header file or library. Best way how to figure out which package is missing is to search for requested file on http://packages.debian.org, http://packages.ubuntu.com or similar.

Setting up a build tree

A build tree is a directory structure that contains all the sources and scripts required to compile your Smalltalk/X. Setting up a build tree is not just checking it out from a CVS/SVN or whatever as your Smalltalk/X environment may contain packages from various sources.

Downloading an existing build tree from Jenkins

The easiest way how to set up your own build tree is to download it from Jenkins server. Select a project and search for an artifact file ending with 'build_tree' (such as smalltalkx-jv-branch-6.2.1_build191_linux-gnu_x86_build_tree.tar.bz2)

To setup a build tree on your computer:

  1. download a build tree archive from Jenkins,
  2. unpack it - inside you should find a directory builder containing Rakefile,
  3. change CVS root using provided script (changeCVSroot.sh). Use :pserver:cvs@cvs.smalltalk-x.de:/cvs/stx as new CVS root unless you're member of SWING and have a shell-access to SWING servers.

The hard way - creating a build tree from scratch

To create a build tree from scratch:

  1. check out rakefiles (svn checkout https://swing.fit.cvut.cz/svn/stx/goodies/builder/trunk/rake)
  2. select a project and let rake to checkout all the sources (rake PROJECT=stx:jv-branch checkout)

Note that you'll need to setup a VPN connection to checkout some essential components of Smalltalk/X. Alternatively, you may copy them from a downloaded build tree.

(Re)compiling Smalltalk/X

Once a build tree is (correctly) set up, type

rake compile 

If it does not end up with an error, you're one of the few lucky guys! You managed to (re) compile Smalltalk/X. If not, then it's hard to say what went wrong. You may want to check [buildenvironment/troubleshooting troubleshooting page]... If it compiles, you may start your new Smalltalk/X by following command:

./projects/smalltalk/smalltalk -I --quick

in subdirectory build/stx. The -I means "do not load an image", --quick means "do not load autoloaded classes".

If you have just downloaded a build tree from Jenkins, compilation should take couple of minutes. If you have clean build tree, full compilation may take from 1-2 hours (on Intel 2GHz Core 2 Duo - GCC is really slooooow compiler).

To test compilation when using Jenkins build tree: As the Jenkins build trees does contain all the .o files, if you do a rake compile, actually nothing is really compiled - the build tool just checks that everything is compiled and that there's nothing to (re)compile. To check whether compilation really works, you may:

  1. go to build/stx/libbasic3 (or any other package, this one is good for testing as it is small and not many packages depend on it).
  2. run make clobber (not the 'make' instead of 'rake'!)
  3. run rake compile again. Now you should see individual .st files compiling.

Works? Excellent. Miracle. :-)

Updating a build tree

As the development goes, your build tree may get outdated. To update it, issue

rake update

this command will update source of all packages in the build tree. Of course, you may update individual packages manually using cvs update or svn updade. Subsequent

rake compile

should recompile the system.

Development Workflow

My (meaning JV's :-) typical development workflow is the following: I have two separate build trees, say jv1 and jv2.

  1. update and compile a build tree jv1 (rake update compile)
  2. start the smalltalk from jv1 (cd build/stx && ./project/smalltalk/smalltalk -I --quick)
  3. do the main development in Smalltalk/X IDE, as usual.
  4. once done, commit all changes back to SVN/CVS repositories.
  5. while having Smalltalk/X jv1 still running, update the second build tree jv2.
  6. check if it compiles fine, if not, fix it go to 4.
  7. close the running Smalltalk/X (jv1), go to 1.

Troubleshooting

When things go wrong, check this troubleshooting checklist for common problems (and solutions).

Note: See TracWiki for help on using the wiki.