wiki:Documentation/BuildingStXWithRakefiles

Version 21 (modified by patrik.svestka@…, 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

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, CVS and SubVersion clients. To do so, execute following in a command prompt:
    c:\msys64\usr\bin\pacman.exe -S make cvs    subversion
    
  • 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

Debian (and other derivatives such as Ubuntu or Mint)

Tested on Debian Stretch

Install following packages:

sudo aptitude install ruby mercurial cvs subversion 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

CentOS 7

Tested on CentOS 7.2. 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 
    

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
    

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.

Required software

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.

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