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).