Building X10 from Source

Building X10 From Source

These instructions can be used either to build X10 from source code checked out of the repository or from an X10 source release obtained from the downloads page. To checkout the source code tree that matches a particular X10 release from svn (instead of from a source code release) one simply uses a URL such as https://x10.svn.sourceforge.net/svnroot/x10/tags/SF_RELEASE_2_2_0/ in place of https://x10.svn.sourceforge.net/svnroot/x10/trunk in the instructions below, changing the tag to the release you want to use.

Assumptions and Prerequisites

This assumes that JAVA_HOME is set to a Java 6.0 compatible SDK.

You will also need ant 1.7 or better, as well as g++ 4.2 or better (xlC 10.1.0.4 or better on AIX), binutils, wget, and GNU make.

Note for Linux users: The X10 build uses the javah task, which is not included in the default ant package. You would need to install ant-nodeps (on RedHat/Gentoo-based systems) or ant-optional (on Debian/SuSE-based systems).

Note for Windows users: You must build X10 within the cygwin environment. The minimum Cygwin version required to build X10 is 1.7.1, as Cygwin releases prior to 1.7.1 broke the shared library behavior of g++ 4.3.2. You will have to install (and use) g++ 4.3.2 (packages gcc4-core and gcc4-g++). Either update alternatives to make gcc-4/g++-4 the default gcc/g++ compiler, or set CC=gcc-4 and CXX=g++-4 explicitly in the environment before the build. All of the pre-built Cygwin binaries for X10 are now built with g++ 4.3.2. Make sure you have these packages:  wget, make, binutils, libtool, svn, cvs, patch.

Also note that if you build with GC enabled (default), you need to install the libtool package to get the correct BDWGC build.

Getting the source

If you are building from a source code release, simply untar or unzip it.  If not, checkout the code from SVN.

svn co https://x10.svn.sourceforge.net/svnroot/x10/trunk x10-trunk

Now that you have all the source; build it by doing:

cd x10-trunk/x10.dist
ant dist

See section below for arguments you may wish to pass to ant.

Updating and rebuilding

To refresh the code from svn, do

cd x10-trunk; svn update

Almost always after updating your code from svn, you will need to do a fairly complete rebuilt.

cd x10-trunk/x10.dist
ant squeakyclean dist

Optional arguments to ant

If you want to build a maximally optimized versions of the class libraries, supply the arguments -D NO_CHECKS=true -Doptimize=true  i.e. run

 ant -DNO_CHECKS=true -Doptimize=true squeakyclean dist

NO_CHECKS=true ensures that no constraint type-checks and array bounds checks are performed at run time.
You can also build fairly optimized, but still safe, class libraries by just using -Doptimize=true.

To disable GC, supply the argument -DDISABLE_GC=true. Note that on all platfroms except AIX, GC is enabled by default. GC is not currently supported on AIX.

To build faster, supply -Davailable.procs=n, where n is the number of cores you want to use for the build (default=2).

If you want to use the MPI runtime, supply -DX10RT_MPI=true. For PAMI support, set -DX10RT_PAMI=true. See X10RT Implementations for more details on these.

Optional source components not in the primary SVN

There is no longer a need to download the PGAS binaries for your system – the build will automatically download the appropriate ones using wget. However, if you want to download one yourself from http://dist.codehaus.org/x10/binaryReleases/svn%20head/ (or if you're at IBM and build PGAS from source), set CUSTOM_PGAS=/path/to/pgas/install/dir (pgas2/common/work in a source build).

Example of how to checkout and compile the entire source code on windows

  • Install cygwin to directory c:\cygwin,
    with the packages: gcc4 (all of them), wget, make, binutils, libtool, svn, cvs, patch.
  • Download apache ant to C:\cygwin\home\USERNAME\apache-ant-1.8.0 (version 1.8.0 is current as of this writing, but be sure to use a path that corresponds to the version you downloaded).
  • checkout the source code:
    svn co https://x10.svn.sourceforge.net/svnroot/x10/trunk C:/cygwin/home/USERNAME/x10-trunk
  • Edit the file C:\cygwin\home\USERNAME\.bash_profile
    And add:
    if [ -d "${HOME}/bin" ] ; then
          PATH=${HOME}/bin:${PATH}
    fi
    PATH=${HOME}/apache-ant-1.8.0/bin:${HOME}/x10-trunk/x10.dist/bin:${PATH}
    export CYGWIN="nodosfilewarning"
    LC_ALL=C
    LANG=C
       

    Create a bin directory: C:\cygwin\home\USERNAME\bin
    and add a file there called: x10make
    with the content:

       #!/bin/sh
       cd ~
       cd x10-trunk
       svn up
       cd x10.dist
       ant squeakyclean dist