Compilation error while trying to build ROOT via source with GPU enabled


Hello,

I am attempting to build the latest stable version of ROOT from source with GPU support enabled but I am encountering a compilation error.

Environment:

  • OS: Ubuntu 22.04

  • Compiler: GNU 11.4.0

  • Hardware: 2x NVIDIA RTX 4500 Ada Generation

  • CUDA: 12.6 (Toolkit installed in /usr/local/cuda-12.6)

  • ROOT Version: 6.40.02 (Latest stable version - cloned via git)

Configuration:

I am using the following CMake flags

cmake -DCMAKE_INSTALL_PREFIX=../root_install \ -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.6/bin/nvcc \ -DCMAKE_CUDA_ARCHITECTURES=89 \ -Dcuda=ON \ -Dtmva-gpu=ON \ -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_CUDA_STANDARD=17 \ -Dbuiltin_gl2ps=ON \ -Dbuiltin_ftgl=ON \ ../root_src

```

The Issue:

When running cmake --build . -- install -j24, the build consistently fails at ~66% with the following error:

In file included from input_line_7:10: .../root_build/include/MPSendRecv.h:18:10: remark: building module 'Net' as '.../root_build/lib/Net.pcm' [-Rmodule-build] #include "TSocket.h" ^ Error: Building module 'Net' implicitly. If 'Net' requires a dictionary please specify build dependency: 'G__MultiProc.cxx' depends on 'Net'.

```

Is there a known dependency order issue here, or should I be defining specific build targets to force the order?

Any advice would be appreciated.

Can you attach the full build log? This line alone I don’t quite understand because Net is a listed dependency of MultiProc.

Yes, this is a known bug Issue with incremental builds · Issue #21673 · root-project/root · GitHub
that was fixed very recently [CMake] Make dictionary module dependencies independent of config order by guitargeek · Pull Request #22648 · root-project/root · GitHub by @jonas

Thank you for the reply. I understand now that this is a race condition within the CMake configuration, specifically where G__ targets aren’t fully resolved when ROOT_GENERATE_DICTIONARY runs, causing the build system to attempt implicit module builds.

While I follow the logic of the suggested fix using $<TARGET_EXISTS:G__>, I am unsure about the recommended implementation path for an end-user. Should I be manually patching my local CMakeLists.txt files to include this logic, or is this fix expected to be merged into the branch I am using?

I was thinking of using a sequential build (-j1) to avoid the race condition and to get past the error. Is this an acceptable approach for my installation, or should I be looking to apply the code-level patch you mentioned? Any guidance on the preferred path forward would be greatly appreciated.

Just clone from git master instead of git latest-stable
Or apply the patch locally yourself.
Or wait till the next release in November.
make -j1 might also work.

I tried the build again with -j1, but the build still fails with the same implicit module build error in core/multiproc. Even when forced to be sequential, the system does not seem to recognize that Net is already built:

[ 60%] Building CXX object net/net/CMakeFiles/Net.dir/src/TS3WebFile.cxx.o
[ 60%] Linking CXX shared library ../../lib/libNet.so
[ 60%] Built target Net
[ 60%] Generating G__MultiProc.cxx, ../../lib/MultiProc.pcm
In file included from input_line_7:10:
/home/iit/ROOT/root_build/include/MPSendRecv.h:18:10: remark: building module 'Net' as '/home/iit/ROOT/root_build/lib/Net.pcm' [-Rmodule-build]
#include "TSocket.h"
          ^
Error: Building module 'Net' implicitly. If 'Net' requires a 
dictionary please specify build dependency: 'G__MultiProc.cxx' depends on 'Net'.

I will try to clone the latest master branch from the ROOT Git repository. I am hoping that the dependency fixes (like the $<TARGET_EXISTS:G__> logic discussed) will allow me to move past the error.

I will attempt the build again from the master branch. If the issue persists there, I will reach back out. Thank you for your assistance.