Skip to content

Building groot

peter edited this page Aug 8, 2026 · 1 revision

Building groot

This page describes the current known-good build path for groot.

groot is a ROOT-based C++ application and currently builds against a custom CERN ROOT installation. Building against package-manager ROOT installations, such as Homebrew or apt ROOT, is a project goal but has not yet been verified.

Requirements

Known requirements:

  • CERN ROOT with GUI support
  • CMake 3.13 or newer
  • A C++ compiler compatible with the ROOT build
  • Make or another CMake-supported build tool

groot uses ROOT histograms, canvases, fitting, I/O, GUI widgets, and ROOT dictionary generation. The ROOT installation must include the corresponding components.

Useful ROOT checks:

root-config --version
root-config --features
root-config --cflags
root-config --libs
root-config --cmakedir

Known-good build path

Source the ROOT environment first:

source /path/to/root/bin/thisroot.sh

Then build from the top-level groot directory:

make

The default make target:

  • configures CMake in build/
  • builds the project
  • copies the executable into bin/

After a successful build, run:

./bin/groot

To start the GUI with a ROOT file:

./bin/groot -g data.root

Direct CMake build

You can also call CMake directly:

cmake -S . -B build
cmake --build build -j4

If CMake cannot find ROOT, explicitly pass ROOT's CMake package directory:

cmake -S . -B build -DROOT_DIR="$(root-config --cmakedir)"
cmake --build build -j4

Xcode build

On macOS, the makefile also has an Xcode generator target:

make xcode

This configures the project in build_xcode/ using CMake's Xcode generator.

Clean rebuild

To remove local build products created by the makefile:

make clean

Then rebuild:

make

Packaged ROOT status

The project is intended to eventually build against externally packaged ROOT installations, but this path is not yet confirmed.

Examples of package-manager ROOT installs include:

  • Homebrew ROOT on macOS
  • apt ROOT on Ubuntu or WSL, where available
  • distro-provided ROOT packages on Linux

Until this is verified, do not assume these installs work without CMake or source changes.

When testing a packaged ROOT build, record:

  • operating system and version
  • CPU architecture
  • ROOT version
  • how ROOT was installed
  • output from root-config --features
  • CMake configure command
  • first compiler or linker error

Troubleshooting

CMake cannot find ROOT

Check whether ROOT is active in the shell:

which root-config
root-config --version
root-config --cmakedir

Then configure with:

cmake -S . -B build -DROOT_DIR="$(root-config --cmakedir)"

Missing ROOT GUI headers or libraries

groot depends on ROOT GUI classes such as canvases and TG* widgets. If the build fails on missing GUI headers or symbols, the ROOT installation may not include GUI support or its GUI dependencies may be missing.

Check:

root-config --features
root-config --libs

Compiler or C++ standard mismatch

The compiler used for groot should be compatible with the compiler and C++ standard used to build ROOT. If the build fails inside ROOT headers or Cling dictionary generation, check:

root-config --cflags

and compare that with the compiler selected by CMake.

Stale build directory

If ROOT paths or compiler settings have changed, remove the build directory and configure again:

make clean
make

or:

rm -rf build
cmake -S . -B build
cmake --build build -j4