wiki:Documentation/BuildingStXWithRakefiles

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

Added section Background

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!

Background

A little background information on what buildscripts actually do...

Building Smalltalk/X jv-branch is a little complex and requires number of steps:

  • First, you need to fetch all the sources from various repositories. As of now, from Jan Vrany's BitBucket and from eXept's public CVS. All sources has to be put into proper directory structure.
  • Second, as source of stc and librun is not publicly available, pre-build binaries has to be downloaded. As of now, they're downloaded from (former) SWING Research Group CI Server.
  • Various patches and tweaks has to be applied to sources in order to compile.
  • Finally compile all packages in dependency order

Build scripts utomate all necessary steps so it all happens automagically - ideally it all should be as easy as typing

rake

Not always it is like that, but we aim to make it just like this :-)

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 and CVS clients
  • Ruby 2.1 or newer
  • rake
  • JDK 7
  • Apache Ant

Windows

Tested on Window 7 Professional, 64bit.

  • Install MSYS2 from https://msys2.github.io/. Make sure to install it to C:\MSYS64, otherwise Smalltalk/X build scripts won't find it!. Once installer finishes, open a command prompt and execute following commands:
    c:\msys64\usr\bin\pacman.exe -Sy pacman
    c:\msys64\usr\bin\pacman.exe -Syu
    c:\msys64\usr\bin\pacman.exe -Su
    
  • Note: During pacman -Syu you maybe asked to close command prompt window. Don't forget to close it otherwise you will have to start from beginning.
  • Note2: When you want to start use MSYS2 shell use msys2_shell.cmd (installer installs incorrectly .bat files).
  • Install GNU Make and CVS client. To do so, execute following in a command prompt:
    c:\msys64\usr\bin\pacman.exe -S make cvs
    
  • Add c:\msys64\usr\bin to your PATH:
    setx PATH "%PATH%;c:\msys64\usr\bin"
    
    Close the command prompt an open it again before continuing''' This is important so the new PATH become effective.
  • 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"
    
    Close the command prompt an open it again before continuing''' This is important so the new PATH become effective.
  • 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

Following guides are for building 64bit Smalltalk/X on 64bit Linux (or 32bit Smalltalk/X on 32bit Linux). It is possible - of course - to build ac 32bit Smalltalk/X on 64bit Linux. In that case you need to install 32bit libraries and headers. How to do that is left as an exercise to dear reader/. Hint: on DEB-based distros you need to install pretty much same packages with :i386 suffix, on RPM-based with .i686 plus something like gcc-multilib.

Debian (and other derivatives such as Ubuntu or Mint)

Tested on Debian Stretch, both 64bit and 32bit, standard installations.

Install following packages:

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

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

CentOS 7

Tested on CentOS 7.2 (Minimal). Thanks to Patrik Svestka for this guide!

First couple steps only install X environment. If you already have it installed or don't want it, you may skip them.

  • First install XServer (with xfce)
    sudo yum groupinstall "Development Tools" "X Window system" xfce Fonts
    systemctl set-default graphical.target
    
  • Optional: For the system to have "nice" fonts
    sudo yum install xorg-x11-fonts-Type1 xorg-x11-fonts-misc
    

Following is required to compile Smalltalk/X jv-branch

  • Install rvm (management for ruby - system ruby is not a good idea):
    rvm requirements
    rvm install ruby-2.3
    rvm docs generate-ri # documentation
    
  • Install java (open-jdk 8)
    sudo yum install java
    
  • unixODBC needed to start StX (installs handy ODBC connector)
    sudo yum install unixODBC 
    
  • Versioning systems (for getting the sources from)
    sudo yum install mercurial cvs
    
  • Devel packages needed for compilation
    sudo yum install glib2 libX11-devel libXext-devel qtwebkit libsoup libXft-devel libXinerama-devel ant bison flex
    

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

  • Optional: Install XSLT and DocBook Stylesheets. This is only required if you want to create deployment artifacts, i.e., run rake install or rake artifacts
    sudo yum install libxslt-devel docbook5-style-xsl docbook-style-xsl
    
    Since paths on CentOS differ from those on Debian, workaround this by creating symlinks:
    cd /usr/share/xml/
    mkdir -p docbook/stylesheet/
    cd /usr/share/xml/docbook/stylesheet
    ln -s /usr/share/sgml/docbook/xsl-stylesheets-1.78.1/ docbook-xsl
    

Fedora 23

Tested on Fedora 23 Workstation, 64bit, standard installation. Thanks to Martin Kobetic and Patrik Svestka for hints.

  • Install following packages:
    sudo dnf install gcc java ant ruby rake mercurial cvs bison flex unixODBC glib2 libX11-devel libXext-devel qtwebkit libsoup libXft-devel libXinerama-devel ant 
    

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

Compiling, recompiling and updating

Old contents (for reference only)

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

(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.