For Halloween, I decided to dig the good old ROOT 5 up out of its grave.
Guess what? It resurrected! Spooky, no?
This is Ubuntu 22.04 LTS / x86_64 / GCC 11.3 here.
Below you can find some notes on how to easily build the head of the v5-34-00-patches branch.
First, make sure you have a “comprehensive” set of system packages installed:
sudo apt install binutils gcc g++ gfortran make cmake git curl dpkg-dev
sudo apt install libx11-dev libxpm-dev libxft-dev libxext-dev
sudo apt install libafterimage-dev libgif-dev
sudo apt install liblzma-dev liblz4-dev libxxhash-dev
sudo apt install libfftw3-dev libfftw3-mpi-dev libgsl-dev
sudo apt install libssl-dev libxml2-dev
sudo apt install mesa-common-dev freeglut3-dev libftgl-dev libglew-dev
sudo apt install python3-numpy python3-all-dev python-all-dev
# some optional packages
sudo apt install libgraphviz-dev
sudo apt install libcfitsio-dev
sudo apt install libldap-dev libkrb5-dev
sudo apt install davix-dev libprotobuf-dev
sudo apt install libavahi-compat-libdnssd-dev libavahi-core-dev
sudo apt install unixodbc-dev libpq-dev libsqlite3-dev
sudo apt install default-libmysqlclient-dev # MySQL 8.0.x
Then you can easily build ROOT “in-place” ... using its “./configure” script:
rm -rf v5-34-00-patches
git clone --depth 1 --branch v5-34-00-patches https://github.com/root-project/root.git v5-34-00-patches
cd v5-34-00-patches
unset ROOTSYS # just a precaution
# build ... using the compiler's default C++ standard (e.g., C++98, C++11, C++14, or C++17)
./configure --all --disable-builtin-afterimage --disable-builtin-lz4 --enable-gsl-shared --disable-memstat --enable-soversion --disable-xrootd 2>&1 | tee -a configure.out.txt
# ... or ... using C++11 compatible mode
# ./configure --enable-cxx11 --all --disable-builtin-afterimage --disable-builtin-lz4 --enable-gsl-shared --disable-memstat --enable-soversion --disable-xrootd 2>&1 | tee -a configure.out.txt
# ... or ... using C++14 compatible mode
# ./configure --enable-cxx14 --all --disable-builtin-afterimage --disable-builtin-lz4 --enable-gsl-shared --disable-memstat --enable-soversion --disable-xrootd 2>&1 | tee -a configure.out.txt
nice make -k -j$(($(nproc)+1)) 2>&1 | tee -a make.out.txt
cd ..
... or using CMake:
rm -rf v5-34-00-patches
git clone --depth 1 --branch v5-34-00-patches https://github.com/root-project/root.git v5-34-00-patches
rm -rf v5-34-00-patches-build
mkdir v5-34-00-patches-build
cd v5-34-00-patches-build
unset ROOTSYS # just a precaution
# build ... using the compiler's default C++ standard (e.g., C++98, C++11, C++14, or C++17)
cmake -Dall=ON -Dbuiltin_afterimage=OFF -Dbuiltin_glew=OFF -Dbuiltin_ftgl=OFF -Dgsl_shared=ON -Dmemstat=OFF -Dsoversion=ON -Dxrootd=OFF ../v5-34-00-patches 2>&1 | tee -a cmake.out.txt
# ... or ... using C++11 compatible mode
# cmake -Dcxx11=ON -Dall=ON -Dbuiltin_afterimage=OFF -Dbuiltin_glew=OFF -Dbuiltin_ftgl=OFF -Dgsl_shared=ON -Dmemstat=OFF -Dsoversion=ON -Dxrootd=OFF ../v5-34-00-patches 2>&1 | tee -a cmake.out.txt
# ... or ... using C++14 compatible mode
# cmake -Dcxx14=ON -Dall=ON -Dbuiltin_afterimage=OFF -Dbuiltin_glew=OFF -Dbuiltin_ftgl=OFF -Dgsl_shared=ON -Dmemstat=OFF -Dsoversion=ON -Dxrootd=OFF ../v5-34-00-patches 2>&1 | tee -a cmake.out.txt
nice cmake --build . -- -j$(($(nproc)+1)) 2>&1 | tee -a cmake.build.out.txt
cd ..
If anything goes wrong, you have two additional “*.out.txt” files to look into.
If you want to debug your code, you might like to add the “--build=debug” option in the “./configure” command line (“-DCMAKE_BUILD_TYPE=Debug” when using CMake).
In any case, before building a new ROOT version, always make sure that nothing in your environment variables (i.e., whatever the “${ROOTSYS}/bin/thisroot.sh” script sets, e.g., “ROOTSYS”, “PATH”, “LD_LIBRARY_PATH”, “PYTHONPATH”, “CMAKE_PREFIX_PATH”, and so on) points to another existing version of ROOT. Otherwise, you may end up with a broken build.
If you want to rebuild your ROOT, always start from a clean source code so that no remnants of any “old build” are present. For example, run “make distclean” (or maybe better “make maintainer-clean”) before the new “./configure” step (“rm -rf v5-34-00-patches-build” when using CMake).
Known quirks:
-
The “
./configure” script tries to execute the “python” executable, which may not be present.
So, if you want the “python” feature enabled, execute first, e.g., “ln -fs /usr/bin/python2 ${HOME}/bin/python” or “ln -fs /usr/bin/python3 ${HOME}/bin/python”.
I think one only needs the “python” symbolic link when building ROOT. Afterward, one can explicitly call “python2” (“python3”) and “import ROOT”.
This problem does not exist when using CMake (and one can also explicitly use, e.g., “-DPYTHON_EXECUTABLE=/usr/bin/python2” or “-DPYTHON_EXECUTABLE=/usr/bin/python3”).
Note: I do not know how good or how bad the support for a modern “python3” is (“python2” is fully supported). -
The “
./configure” script tries to execute the “freetype-config” script, which is no longer provided by the new “libfreetype-dev” package. As a result, it will always enable the “builtin_freetype” feature.
This problem does not exist when using CMake. -
When the “
builtin_afterimage” feature is enabled, the “./configure” script cannot find the “tiffio.h” file (which is present in the “/usr/include/x86_64-linux-gnu” directory). Well, this may create some problems with the TIFF graphics format support. -
When using CMake, some ROOT scripts explicitly execute the “
cmake” executable, which may not be present. So, e.g., one cannot just use “cmake3”, but one needs to execute first “ln -fs /usr/bin/cmake3 ${HOME}/bin/cmake”. This problem does not exist when using “./configure”. -
When using CMake, the ROOT “
proof/proofbench/src” source code directory must be writeable when building ROOT (due to a bug in the “etc/proof/utils/makepbenchpars.sh” script). This problem does not exist when using “./configure”. -
If neither the “
--enable-cxx11” (“-Dcxx11=ON” in CMake) nor the “--enable-cxx14” (“-Dcxx14=ON” in CMake) option is used, ROOT will be built with the compiler’s defaultC++standard, e.g., “C++98”, “C++11”, “C++14”, or “C++17” (note: “C++20” and newer are not supported).