wiki:InstallingFACT++

Version 31 (modified by tbretz, 3 months ago) (diff)

--

Checking out FACT++

First you need to get FACT++ from the svn-repository. The default command will checkout it into a sub-directory called "directory" at the current directory. It will be created if not existing. If the argument is omitted, the default directory is FACT++.

[0] svn checkout https://www.fact-project.org/svn/trunk/FACT++ [directory]
[1] cd FACT++

Creating the build system

Now create a new sub-directory build (or with your preferred name) in your main source directory (here assuming the default name was used)

[2] mkdir build
[3] cd build

And call cmake from there (the ".." is intentional!)

[4] cmake ..

As a default, the project is compiled with the build type Release, thus all optimization is enabled and debug symbols are switched off. To enable debug symbols, you can use the build mode 'Debug' or 'RelWithDebInfo', e.g.

[4] cmake -DCMAKE_BUILD_TYPE=Debug ..

As a default, cmake will try to find the compiler suite 'clang/clang++', 'gcc/g++' and 'cc/c++' (in this order). If you want to define a compiler yourself, then you can call cmake like this

[4] cmake -DCMAKE_C_COMPILER=clang-4.0 -DCMAKE_CXX_COMPILER=clang++--4.0 ..

instead. Note that not all versions of clang are compatible with all version of the boost-libraries on Ubuntu. You might have to try different versions. (However, it is worth it, because clang is much faster).

If you only want to compile the basic tools (rootifysql, root2sql, fits2sql, fitsdump and zfits) you can add -DTOOLS_ONLY=1 when calling cmake. This simplifies compilation because less packages are required (for example the whole QT stuff is not needed).

If a package is missing, you will see an error which looks like this

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Nova (missing: NOVA_LIBRARY NOVA_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindNova.cmake:11 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:131 (FIND_PACKAGE)

It is a bit tricky to find out which package is missing at the moment. The important line is line #2

Could NOT find Nova (missing: NOVA_LIBRARY NOVA_INCLUDE_DIR)

In this case, it is the development package of the nova library (libnova-dev).

If you find something missing during compilation which is not checked, please let me know. As a good practice please attach the complete output of cmake and of make. To clean up your build tree and start from scratch simple remove the directory (rm -rf build) and start over with step [2].

Hint: To get an idea what cmake is doing or has done, you can call cmake-gui . in the build directory. Note that the . is required.

Usually, there is XXX_INCLUDE_DIR which is a a path to the header files and XXX_LIBRARY which is the library filename (including path). You can then do, for exmaple

[4] cmake -DMYSQL_INCLUDE_DIR=~/mysql/include -DMYSQL_LIBRARY=~/mysql/libmysqlclient.so ..

To check what cmake actually found, you can call

[4] cmake-gui .

Compiling FACT++

Then call

[5] make -jN

where N is the numbers of threads you want to utilize (check the number of CPU cores you can keep busy). Or you can omit the -jN in case you want to run on a single CPU.

Packaging FACT++

Once successfully compiled, you can package the tool-set and build a tar-archive and a Debian package by

[6] make package

The Debian package can then be installed system wide with

[7] dpkg -i fact++-YYWWDDHH.deb

where YYWWDDHH is the version number compiled from the time when cmake was called.

Old Information

Some older information can be found here https://fact-project.org/FACT++/. It describes the old build system, but apart from that should be more or less accurate.

Compilation on our systems

ISDC

Make sure that the root-version you wanna use is properly initialized by calling

/swdev_nfs/root_v5.34.38/bin/thisroot.sh

The start cmake before calling make:

/swdev_nfs/cmake-3.5.0-Linux-x86_64/bin/cmake \
-DTOOLS_ONLY=1 \
-DBOOST_ROOT=/swdev_nfs/boost_1_47_0/ \
-DMYSQL_LIBRARY=/swdev_nfs/mysql-5.7.23-linux-glibc2.12-x86_64/lib/libmysqlclient.so \
-DMYSQL_INCLUDE_DIR=/swdev_nfs/mysql-5.7.23-linux-glibc2.12-x86_64/include/ \
-DMYSQLPP_LIBRARY=/swdev_nfs/mysql++-3.2.4/libmysqlpp.so \
-DMYSQLPP_INCLUDE_DIR=/swdev_nfs/mysql++-3.2.4/lib/ \
-DNOVA_INCLUDE_DIR=/swdev_nfs/libnova-0.15.0/include/libnova/ \
-DNOVA_LIBRARY=/swdev_nfs/libnova-0.15.0/lib/libnova.so  \
/path/to/CMakeList.txt

It is all a newer version, a newer required version, or compiled with mysqlclient 5.7.23, or all of that. Make sure that the root-version cmake finds is also compiled with the same mysqlclient-library, e.g. by

/swdev_nfs/cmake-3.5.0-Linux-x86_64/bin/cmake \
-DMYSQL_LIBRARY=/swdev_nfs/mysql-5.7.23-linux-glibc2.12-x86_64/lib/libmysqlclient.so \
-DMYSQL_INCLUDE_DIR=/swdev_nfs/mysql-5.7.23-linux-glibc2.12-x86_64/include \
/swdev_nfs/root_v5.34.38-source/

Known to work

  • cmake 3.5.0 / 3.5.1 / 3.10.2
  • Scientific Linux 6.10 with Boost 1.47.0 and gcc 4.4.7
  • Ubuntu 16.04 with Boost 1.58.0 and clang 3.8 / 4 .0 / 5.0 / 6.0 or gcc 5.4.0
  • Ubuntu 18.04 with Boost 1.65.1 and clang 6.0 or gcc 7.3.0
  • root 5.34/36, 5.34/38, 6.12/06
  • Qt4 4.8.7
  • libz 1.2.3 / 1.2.8 / 1.2.11
  • mysqlclient 5.7.23 (20.3.10) / 8.0.12 (21.0.12)
  • openssl 1.0.1e / 1.0.2g / 1.1.0g
  • libnova 0.12 / 0.15.0
  • mysql++ 3.2.2 / 3.2.4

Not all combinations might work though. (There are known problems with openssl 1.1.0 and Ubuntu 16.04: downgrade openssl to 1.0.*)

As a default, from cmake 3.6 onwards, the libmysqlclient (MySQL) to which the project is linked is automatically obtained from the libmysqlpp library (MySQL++).