Number 5 is Alive!

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 default C++ standard, e.g., β€œC++98”, β€œC++11”, β€œC++14”, or β€œC++17” (note: β€œC++20” and newer are not supported).

9 Likes

Awesome, thanks!
Maybe your binaries for Ubuntu 22 could be added here? Release 53438 - ROOT

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.