Cannot build VecGeom and ROOT together (Ubuntu 20)

I’m trying to build VecGeom and ROOT with the following Dockerfile (it’s really a great container thing that one always has a MWE for free):

And I get the following mysterious compilation error (VERBOSE=1):

[ 87%] Generating G__ROOTVecOps.cxx, ../../lib/libROOTVecOps_rdict.pcm, ../../lib/libROOTVecOps.rootmap
cd /root/build/math/vecops && /usr/bin/cmake -E env rootcling -v2 -f G__ROOTVecOps.cxx -s /root/build/lib/libROOTVecOps.so -m libCore_rdict.pcm -rml libROOTVecOps.so -rmf /root/build/lib/libROOTVecOps.rootmap -writeEmptyRootPCM -I/root/src/math/vecops -I/root/src/math/vecops/inc -I/root/src/core/unix/inc -I/root/src/core/foundation/v7/inc -I/root/src/core/base/v7/inc -I/root/src/core/clingutils/inc -I/root/src/core/textinput/inc -I/root/src/core/thread/inc -I/root/src/core/zip/inc -I/root/src/core/rint/inc -I/root/src/core/clib/inc -I/root/src/core/meta/inc -I/root/src/core/gui/inc -I/root/src/core/cont/inc -I/root/src/core/foundation/inc -I/root/src/core/base/inc -I/root/build/ginclude -I/root/build/ginclude -I/root/src/core/base/inc -I/root/src/core/foundation/inc -I/root/src/core/cont/inc -I/root/src/core/gui/inc -I/root/src/core/meta/inc -I/root/src/core/clib/inc -I/root/src/core/rint/inc -I/root/src/core/zip/inc -I/root/src/core/thread/inc -I/root/src/core/textinput/inc -I/root/src/core/clingutils/inc -I/root/src/core/base/v7/inc -I/root/src/core/foundation/v7/inc -I/root/src/core/unix/inc -I/root/src/math/vecops/inc -I/root/src/core/unix/inc -I/root/src/core/foundation/v7/inc -I/root/src/core/base/v7/inc -I/root/src/core/clingutils/inc -I/root/src/core/textinput/inc -I/root/src/core/thread/inc -I/root/src/core/zip/inc -I/root/src/core/rint/inc -I/root/src/core/clib/inc -I/root/src/core/meta/inc -I/root/src/core/gui/inc -I/root/src/core/cont/inc -I/root/src/core/foundation/inc -I/root/src/core/base/inc -I/root/build/ginclude -I/root/src/math/vecops ROOT/RAdoptAllocator.hxx ROOT/RVec.hxx /root/src/math/vecops/inc/LinkDef.h
No such file or directory
make[2]: Leaving directory '/root/build'
make[2]: *** [math/mathcore/CMakeFiles/G__MathCore.dir/build.make:240: math/mathcore/G__MathCore.cxx] Error 1
make[1]: *** [CMakeFiles/Makefile2:26364: math/mathcore/CMakeFiles/G__MathCore.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
No such file or directory
make[2]: *** [math/vecops/CMakeFiles/G__ROOTVecOps.dir/build.make:68: math/vecops/G__ROOTVecOps.cxx] Error 1
make[2]: Leaving directory '/root/build'
make[1]: *** [CMakeFiles/Makefile2:27268: math/vecops/CMakeFiles/G__ROOTVecOps.dir/all] Error 2

If I compile ROOT alone everything goes smooth, so I assume it’s related to VecGeom. By inspecting the failed build, I realized that the /root/build/math folder does not exist – but no clue how this could be actually related to the VecGeom build. I’m running out of ideas, anyone with a bright one?

Hi @luigipertoldi ,
sorry for the high latency, @oshadura might be able to help.

Cheers,
Enrico

Please make sure you are not using any builtins. Both ROOT and VecGeom have a builtin for VecCore, but if they each enable their own, then you will have two potentially conflicting versions of VecCore while building ROOT.

Uhm ok, that could be the problem indeed – see this log: Dockerfile.txt (2.9 MB). It just says -- Looking for VecGeom, which might mean that CMake does not find it?

How do I prevent that?

Where do you have VecGeom installed? You need to add an option when building ROOT to tell CMake to search in the right places. It could be CMAKE_PREFIX_PATH, or VecGeom_DIR. Please read CMake’s documentation for find_package for more information.

Thanks a lot for the tip, I apparently solved the issue by adding -Dbuiltin_veccore=OFF to the build options.