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 ashttps://svn.code.sourceforge.net/p/x10/code/tags/SF_RELEASE_2_4_2/ in place ofhttps://svn.code.sourceforge.net/p/x10/code/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.4 or better (optionally xlC 11.1 or better), binutils, wget, and GNUmake.
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 MacOS users: The default Java installation on recent versions of MacOS is not a complete JDK even if it comes with the javac compiler. You must install a proper JDK to build X10 from sources, that is, either a Java Developer Package for Java 6 from Apple or a Java 7 JDK from Oracle. If JAVA_HOME is not set, the build will use the preferred Java installation as returned by /usr/libexec/java_home.
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. Make sure you have these packages: gcc, g++, wget, make, binutils, diffutils, libtool, svn, patch.
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://svn.code.sourceforge.net/p/x10/code/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 X10RTImplementations for more details on these.
Example of how to checkout and compile the entire source code on windows
- Install cygwin to directory c:\cygwin,
with the packages: gcc (all of them), wget, make, binutils, libtool, svn, 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://svn.code.sourceforge.net/p/x10/code/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