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