Skip to content
Sascha Wagner edited this page Feb 26, 2020 · 43 revisions

Blaster only

If you want to install Ant on your local machine, skip this section and go to Preparation.

If you want to install Ant on blaster, you can skip the first part of this guide. To use a fairly recent version of cmake and gcc as well as a precompiled version of ROOT, have a look at the helper scripts in /local/raid0/Package/env to setup an environment using the versions you want to use. If you'd like to have GCC8.1 for example together with ROOT5, just add

source /local/raid0/Package/env/env_gcc81_root5.sh

to your .bashrc. Replace root5 with root6 to use ROOT6 (right now it's version 6.14/00). Or just use

source /local/raid0/Package/env/env_gcc72.sh

if you would like to have only cmake and gcc in version 7.2. If you source a env_*.sh including ROOT, you can go immediately to installing APLCONpp of this guide and continue there.

Preparation

In this guide Ant and all dependencies that we are going to build from source will be installed in a directory called "opt" inside your home directory. If you wish to place it somewhere else replace all paths accordingly.

To enable multi-threaded building of the source code on multi-processor/core systems run this command or place it in your ~/.bashrc file to active it automatically:

alias make="make -j$(nproc) --no-print-directory"

The last --no-print-directory part is just for systems where make prints enter and leave directory for each directory change and can be omitted.

Getting general dependencies and tools

First, you should check if your system is up to date and if not install updates (supposing you work on Debian):

apt update && apt full-upgrade
apt install git gitk git-gui cmake cmake-gui qtcreator
mkdir opt

Install CERN ROOT

There are many ways to install CERN ROOT. Here is a guide that works for the use with Ant. If you already have ROOT on your system, make sure it was configured to use the systems zlib- and xz-libraries instead of it's builtin ones. Otherwise Ant will have problems later. Also gsl (GNU Scientific library) support is required.

On Debian based systems install these prerequisites before compiling root:

sudo apt install git dpkg-dev cmake g++ \
gcc binutils libx11-dev libxpm-dev libxft-dev \
libxext-dev gfortran libssl-dev libpcre3-dev \
xlibmesa-glu-dev libglew1.5-dev libftgl-dev \
libfftw3-dev libcfitsio-dev \
graphviz-dev libavahi-compat-libdnssd-dev \
libldap2-dev python-dev libxml2-dev libkrb5-dev \
libgsl0-dev libqt4-dev liblzma-dev

If you're running a Fedora flavoured system the prerequisites are:

sudo yum install git cmake gcc-c++ gcc binutils \
libX11-devel libXpm-devel libXft-devel libXext-devel \
gcc-gfortran openssl-devel pcre-devel mesa-libGL-devel \
mesa-libGLU-devel glew-devel ftgl-devel \
fftw-devel cfitsio-devel graphviz-devel \
avahi-compat-libdns_sd-devel libldap-dev python-devel \
libxml2-devel gsl-static liblzma-devel

In case of errors or problems you may also consult the ROOT prerequisite page.

Then, go to the folder where we install everything,

cd ~/opt

and clone the ROOT repository to root-git. The repository used here contains ROOT5 with some patches from A2. You can also use the official version of ROOT from CERN, as the crucial patches are merged upstream. You can use ROOT5 or ROOT6, depending on which version you prefer to use.

git clone https://github.com/A2-Collaboration/cern-root.git root-git

Important note on ROOT5:

If you want to use ROOT5 you should have a compiler not newer than GCC 8.X or Clang 7.X on your system. Starting with GCC 9 and Clang 8 ROOT5 does not compile anymore!

In case you want to use ROOT6, you may download the latest release from the official website and extract the files. Just keep in mind that the path might be different from root-git in the following commands and you have to change it accordingly.

Create a build directory and go there.

mkdir root && cd root

Then configure the ROOT build with cmake:

cmake -Dcxx11=ON -DCxx14=ON \
      -Dbuiltin_lzma=OFF -Dbuiltin_zlib=OFF -Dfortan=ON \
      -Dmathmore=ON -Droofit=ON -Dminuit2=ON ../root-git

And finally build:

make

This may take up to 30 minutes.

In case you have problems building ROOT (for example on Ubuntu 16 g++ crashes) try disabling the cxx11/14 options: -Dcxx11=OFF -DCxx14=OFF. Then source the setup script of root. It will set up the environment variables.

source $HOME/opt/root/bin/thisroot.sh

You should add this line to your ~/.bashrc to automatically set stuff up when you launch a shell.

Install APLCON with C++ Wrapper

APLCONpp is a C++11 wrapper for constrained least square fitter in Fortran by Volker Blobel. The easiest way is to place APLCONpp into the same folder as Ant. That way cmake will definitely find it later. Just also put it into the opt folder together with everything else.

cd ~/opt
git clone https://github.com/A2-Collaboration/APLCONpp.git

Then create a build directory inside of it and build:

cd APLCONpp
mkdir build && cd build
cmake ..
make

Install Pluto

ROOT5 Case

If you chose ROOT6, have a look at the instructions for pluto6.

First, get the source code:

cd ~/opt
git clone https://github.com/A2-Collaboration/gsi-pluto.git pluto
cd pluto

Before you continue, make sure you configured your environment for ROOT by sourceing thisroot.sh, see above. Then to build pluto for ROOT5, just use:

make

Then execute these lines and also add them to your ~/.bashrc to publish the install location of Pluto:

export PLUTOSYS=$HOME/opt/pluto
export LD_LIBRARY_PATH=$PLUTOSYS:$LD_LIBRARY_PATH

ROOT6 Case

For ROOT6 you need a modified version, called pluto6:

cd ~/opt
git clone https://github.com/A2-Collaboration/pluto6
cd pluto6

In case you skipped the ROOT5 part above: Before you continue, make sure you configured your environment for ROOT by sourceing thisroot.sh, see above. Then to build pluto6 for ROOT6, create a build directory and compile it:

mkdir build && cd build
cmake ..
make

Then execute these lines and also add them to your ~/.bashrc to publish the install location of Pluto:

export PLUTOSYS=$HOME/opt/pluto6/build
export LD_LIBRARY_PATH=$PLUTOSYS:$LD_LIBRARY_PATH

Install Ant

Now you should be finally able to compile the Ant framework. Therefore clone this repository, either directly or you may want to fork it. Go to the place you want to place your Ant installation. As mentioned above, the installation works best when the APLCONpp and ant folder reside in the same directory. Then clone the repository. If you plan to contribute and push your changes to the repository you might want to use the ssh-URL instead of the https:// one.

git clone https://github.com/A2-Collaboration/ant.git

or

git@github.com:A2-Collaboration/ant.git

It is usually a good idea to have at least two build directories, one for a "release" build and one for "debug". For normal running of Ant the optimized "release" build is much faster. But for hunting down bugs and using the debugger a "debug" build is required.

cd ant
mkdir build_{release,debug}

You can then build the optimized version like this:

cd build_release
cmake ..
make

If APLCONpp is not in the same directory as ant (say in /opt instead of ~/opt), you can issue:

cmake -DAPLCONpp_LIBRARY=/opt/APLCONpp/build/libaplcon++.so -DAPLCONpp_INCLUDE_DIR=/opt/APLCONpp/src/ ..

Optional: Add Ant to your $PATH

If you want to be able to run Ant or another tool via your terminal without specifying the whole path to the binary, you may want add the build directory created earlier to your PATH environment variable. Assuming you're using bash, open the file ~/.bashrc with an editor of your choice and append the following line:

export PATH=$PATH:~/opt/ant/build_release/bin

If you open a new terminal now, your shell is aware of the compiled binaries of Ant and invoking i.e. Ant --help should print the help dialogue of Ant.

Bonus: For extra convenience you can also source the bash_complete.sh script from the extra directory to get handy tab completions for Ant.

Side note:

Within the build directory you created you also find a rootlogon.C which can be used while opening ROOT. Your ROOT session is then aware of Ant and its libraries, e.g. you can open root files created by Ant containing histograms which ROOT doesn't know of like TH2CB or ant::hstack as well as the TAntHeader within every Ant-created root file.

QtCreator configuration

QtCreator is a C++ IDE. We recommend to use it for developing with Ant. (It was already installed in the beginning of this HowTo).

qtcreator ant/CMakeLists.txt

Then go to "Project" and configure the build directories for the Default/Release and Debug build accordingly.

For maintaining the Ant Code Style go to OptionsC++Code Style and import the file ant/doc/Ant-Codestyle.xml