Installation from tarball

Requisites

There are several requisites to be fulfilled when installing from the tarball, since the source code must be build using a compiler.

  • A supported platform: A Linux platform supporting dynamic shared objects (i386, IA64, PowerPC, etc)
    • Compilation in Win32 under MSYS or Cygwin is possible but it is not supported. Use at your own risk!
  • GNU gcc 4.1 (or better) compiler with C++ support
  • GNU Bison 2.3 or better (Note: bison-rofi is not needed anymore)
    • bison 2.4 is known to fail, use bison 2.4.1 instead
  • GNU gperf 3.0.0 or better
  • GNU flex 2.5.4 or 2.5.33 or better
    • flex 2.5.31 and 2.5.34 are known to fail
  • Python 2.4 or better

Many of these tools are probably packed in your distribution (if not already installed), so check your Linux distribution documentation in order to install them.

 Environment

In this example we are going to install Mercurium into its own directory. This is recommended since it eases further uninstallation. The root of the Mercurium installation will be called $MERCURIUM. Before doing anything, set it to a path where you want Mercurium to be installed.

For instance a jdoe user could set the $MERCURIUM variable like this (the $ sign represents your bash prompt, do not type it)

$ export MERCURIUM=/home/jdoe/mercurium

Make sure that from now you have all requisites fulfilled.

Getting the source code

Please go to download area in Mercurium trac. This version is updated from time to time, so if you want a newer version you can go to our nightly build area. Note that if you are obtaining the source code from the git repository some extra steps will be required before configuration (no unpack would be required in that case)

Unpack

Unpack mcxx-version.tar.bz2 typing

$ tar xfj mcxx-version.tar.bz2

change version to the exact version tarball you have.

Configuration

Now create a build directory, where all the compiler will be built. This is recommended since if the package gets miscompiled, you can easily wipe the contents of this build directory and run configure again.

$ mkdir mcxx-build
$ cd mcxx-build

Now run configure. This script will prepare the build directory so it is ready to compile the compiler. There are several flags you should be aware of when configuring, they are detailed below. (Note that every --enable-xxx option can be disabled using --disable-xxx)

  • --prefix=dir
    This is the prefix of the installation. This should be $MERCURIUM, otherwise by default this is '/usr/local' which may not be what you want.
  • --enable-tl-openmp-nanos4
    It states that the OpenMP phase for Nanos 4 will be compiled. This flag requires --with-nanos4 (see below)
  • --enable-tl-openmp-nanox
    It states that the OpenMP phase for Nanos 4 will be compiled. This flag requires --with-nanox (see below) 
  • --with-nanos4=dir
    Required when --enable-tl-openmp-nanos4 is set. This is the root directory of the Nanos 4 runtime. This directory is not used when compiling Mercurium, it is only required to generate the configuration files for mcc and mcxx profiles. Should the directories containing headers and lib not be dir/include and dir/lib, you can override those using --with-nanos4-include=dir and --with-nanos4-lib=dir.
  • --with-nanox=dir
    Required when --enable-tl-openmp-nanox is set. This is the root directory of the Nanox runtime. This directory is not used when compiling Mercurium, it is only required to generate the configuration files for mcc and mcxx profiles. Should the directories containing headers and lib not be dir/include and dir/lib, you can override those using --with-nanox-include=dir and --with-nanox-lib=dir.
  • --enable-tl-instrumentation
      It states that the compiler will enable the instrumentation phase using Mintaka. This flag requires --with-mintaka.
  • --with-mintaka=dir
    Required when --enable-tl-instrumentation is set. This is the root directory of the Mintaka library. This directory is not used when compiling Mercurium, it is only required to generate the configuration files for mcc and mcxx profiles. You can use --with-mintaka-include=dir and --with-mintaka-lib=dir if dir/include or dir/lib do not have the headers or libraries, respectively, of Mintaka.
  • --enable-tl-superscalar
    This enables Superscalar compiler parts (not covered here). When this option is set you can also set --with-superscalar=dir
  • --enable-tl-tests
    --enable-tl-examples

    Enables compilation of tests written in TL and some examples. This is disabled by default.
  • --disable-file-regeneration
    Some source code files are generated during compilation, this flag would disable such regeneration. This disallows modification of grammar, lexer and gperf files.
  • --enable-flex-regeneration
    --enable-bison-regeneration
    --enable-gperf-regeneration

    Configure checks for suitable versions of these programs, if it cannot figure out the version or it is a non supported one regeneration of related files will be disabled. With this flag you can override this behaviour, regardless of what configure thinks.

In addition you can define environment variables BISON, FLEX and GPERF to override automatic detection of these tools.

Configure should be invoked within build directory, in our example is mcxx-build. Next line could be a typical configuration invocation (assuming Nanos4 is installed in $MERCURIUM)

$ ../mcxx-version/configure --prefix=$MERCURIUM --enable-tl-openmp-nanos4 --with-nanos4=$MERCURIUM 

At the end of the configuration there is a summary with all the options enabled in the compiler. If the configure script ends successfully you can proceed to compilation. This step lasts more or less depending on the horsepower of your computer.

$ make

(Note that if you have more than one processor you can do a parallel compilation using make -j NUM_THREADS)

Once compiled you must install the compiler prior using it

$ make install

Ready!

You can test everything went allright adding $MERCURIUM/bin into your path and trying to run plaincc.

$ export PATH=$MERCURIUM/bin:$PATH
$ plaincc
You must specify an input file

From here you can check how configuration files work in Mercurium and learn the command line flags.