Building ROOT 6.26/06 from source with R bindings enabled on Ubuntu 20.04 or 22.04


ROOT Version: 6.26/05
Platform: Linux
Compiler: g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0


Hello all,

Having built ROOT from source several times now, I am flummoxed that I have been unable to upgrade and build the latest version of ROOT. Moreover, I am attempting to build on two machines with the same parameters above, but they appear to fail at two different points. The difference appears to be that one is able to find a directory associated with R, while the other does not. How I build ROOT follows the latest instructions found here under “Build from source”, but with the following modifications:

  1. Relative to my home directory, I create a directory named ROOT. Inside of it I have root_src, root_build, and root_include.
  2. From inside of ROOT/root_build I issue the commands
cmake -DCMAKE_INSTALL_PREFIX=../root_install -Dr=ON ../root_src

and then

cmake --build . -- install -j$(nproc)

On the machine which reports that it cannot find the R directory the build gets along further but fails near the end with the output

[100%] Built target PyMVA
[100%] Built target onepcm
[100%] Generating lib/modules.idx
malloc(): invalid size (unsorted)
Aborted (core dumped)
gmake[2]: *** [CMakeFiles/modules_idx.dir/build.make:976: lib/modules.idx] Error 134
gmake[2]: *** Deleting file 'lib/modules.idx'
gmake[1]: *** [CMakeFiles/Makefile2:8104: CMakeFiles/modules_idx.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

while the machine which does find an R directory fails earlier in the build with the output

[ 83%] Built target Rint
[ 83%] Generating G__MathMore.cxx, ../../lib/MathMore.pcm
<<< cling interactive line includer >>>: fatal error: module file '/home/john/ROOT/root_build/lib/Rint.pcm' is out of date and needs to be rebuilt: could not read module signature
<<< cling interactive line includer >>>: note: imported by module 'MathCore' in '/home/john/ROOT/root_build/lib/MathCore.pcm'
Error: Module 'MathCore.pcm' failed to load.
Error: Error loading the default rootcling header files.
gmake[2]: *** [math/mathmore/CMakeFiles/G__MathMore.dir/build.make:142: math/mathmore/G__MathMore.cxx] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:26656: math/mathmore/CMakeFiles/G__MathMore.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

With this second message I tried deleting the lib/*.pcm files as suggested here, but that didn’t work. Nor did deleting and rebuilding the root_build and root_include directories.

Thank you in advance for any help in resolving these build issues!

Since posting this message, I have found this message. I am seeing if issuing the command

cmake -DCMAKE_INSTALL_PREFIX=../root_install -Drpath=ON -Dr=ON ../root_src

then issuing the command

cmake --build . -- install -j$(nproc)

resolves the issues I have been having on my machine where R was found by cmake. What I am unsure of now though is what @Wile_E_Coyote means when they say

Then execute “make install”, rename the original “<builddir>” (so that the newly installed libraries will NOT find the originals) and try “ldd” on all newly installed libraries.

And how it applies to the steps I am describing above? What would I be renaming? root_build? Does this mean I would temporarily rename root_build to something else, then rename it back after issuing the command

cmake --build . -- install -j$(nproc)

Where would I find the libraries I would need to “ldd”?

So issuing the command

cmake -DCMAKE_INSTALL_PREFIX=../root_install -Drpath=ON -Dr=ON ../root_src

followed by

cmake --build . -- install -j$(nproc)

did not resolve the problem on the machine where R was found by cmake, but it did progress further in the build. The build now ends around the input

[ 97%] Built target RooFitRDataFrameHelpers
[ 97%] Generating lib/modules.idx
malloc(): invalid size (unsorted)
Aborted (core dumped)
gmake[2]: *** [CMakeFiles/modules_idx.dir/build.make:308: lib/modules.idx] Error 134
gmake[2]: *** Deleting file 'lib/modules.idx'
gmake[1]: *** [CMakeFiles/Makefile2:8152: CMakeFiles/modules_idx.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

I am nor sure how the R binding works. May be @axel has some ideas?

This isn’t necessarily caused by the R bindings: the crash is in the generation of module.idx where apparently a memory error happens. Can you (after the build step has stopped with the error) run make VERBOSE=1 and show the output? There will be a call to root which fails; I’d like to see what that is.

So at the moment I can only access one of the machines. On the machine where an R directory could not be found, the output ended with

[ 98%] Built target G__RooFitRDataFrameHelpers
make  -f roofit/RDataFrameHelpers/CMakeFiles/RooFitRDataFrameHelpers.dir/build.make roofit/RDataFrameHelpers/CMakeFiles/RooFitRDataFrameHelpers.dir/depend
make[2]: Entering directory '/home/john/ROOT/root_build'
cd /home/john/ROOT/root_build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/john/ROOT/root_src /home/john/ROOT/root_src/roofit/RDataFrameHelpers /home/john/ROOT/root_build /home/john/ROOT/root_build/roofit/RDataFrameHelpers /home/john/ROOT/root_build/roofit/RDataFrameHelpers/CMakeFiles/RooFitRDataFrameHelpers.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/john/ROOT/root_build'
make  -f roofit/RDataFrameHelpers/CMakeFiles/RooFitRDataFrameHelpers.dir/build.make roofit/RDataFrameHelpers/CMakeFiles/RooFitRDataFrameHelpers.dir/build
make[2]: Entering directory '/home/john/ROOT/root_build'
make[2]: Nothing to be done for 'roofit/RDataFrameHelpers/CMakeFiles/RooFitRDataFrameHelpers.dir/build'.
make[2]: Leaving directory '/home/john/ROOT/root_build'
[ 98%] Built target RooFitRDataFrameHelpers
make  -f CMakeFiles/modules_idx.dir/build.make CMakeFiles/modules_idx.dir/depend
make[2]: Entering directory '/home/john/ROOT/root_build'
cd /home/john/ROOT/root_build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/john/ROOT/root_src /home/john/ROOT/root_src /home/john/ROOT/root_build /home/john/ROOT/root_build /home/john/ROOT/root_build/CMakeFiles/modules_idx.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/john/ROOT/root_build'
make  -f CMakeFiles/modules_idx.dir/build.make CMakeFiles/modules_idx.dir/build
make[2]: Entering directory '/home/john/ROOT/root_build'
[ 98%] Generating lib/modules.idx
cd /home/john/ROOT/root_build/lib && /usr/bin/cmake -E remove -f modules.idx modules.timestamp
cd /home/john/ROOT/root_build/lib && LD_LIBRARY_PATH=/home/john/ROOT/root_build/lib:/home/john/ANITA_util_install_dir/lib:/home/john/anitaBuildTool/components/icemc:/home/john/anitaBuildTool/build/components/icemc/:/home/john/ANITA_util_install_dir/lib::/home/john/ANITA_util_install_dir/lib:/home/john/anitaBuildTool/components/icemc:/home/john/anitaBuildTool/build/components/icemc/:/home/john/ANITA_util_install_dir/lib ROOTIGNOREPREFIX=1 ROOT_HIST=0 /home/john/ROOT/root_build/bin/root.exe -l -q -b
malloc(): invalid size (unsorted)
Aborted (core dumped)
make[2]: *** [CMakeFiles/modules_idx.dir/build.make:1200: lib/modules.idx] Error 134
make[2]: *** Deleting file 'lib/modules.idx'
make[2]: Leaving directory '/home/john/ROOT/root_build'
make[1]: *** [CMakeFiles/Makefile2:8104: CMakeFiles/modules_idx.dir/all] Error 2
make[1]: Leaving directory '/home/john/ROOT/root_build'
make: *** [Makefile:156: all] Error 2

Thanks. So

cd /home/john/ROOT/root_build/lib && LD_LIBRARY_PATH=/home/john/ROOT/root_build/lib:/home/john/ANITA_util_install_dir/lib:/home/john/anitaBuildTool/components/icemc:/home/john/anitaBuildTool/build/components/icemc/:/home/john/ANITA_util_install_dir/lib::/home/john/ANITA_util_install_dir/lib:/home/john/anitaBuildTool/components/icemc:/home/john/anitaBuildTool/build/components/icemc/:/home/john/ANITA_util_install_dir/lib ROOTIGNOREPREFIX=1 ROOT_HIST=0 /home/john/ROOT/root_build/bin/root.exe -l -q -b

should reproduce this. Can you re-run with

LD_LIBRARY_PATH=/home/john/ROOT/root_build/lib:/home/john/ANITA_util_install_dir/lib:/home/john/anitaBuildTool/components/icemc:/home/john/anitaBuildTool/build/components/icemc/:/home/john/ANITA_util_install_dir/lib::/home/john/ANITA_util_install_dir/lib:/home/john/anitaBuildTool/components/icemc:/home/john/anitaBuildTool/build/components/icemc/:/home/john/ANITA_util_install_dir/lib ROOTIGNOREPREFIX=1 ROOT_HIST=0 /home/john/ROOT/root_build/bin/root.exe -e 'gDebug=7' -l -q -b > axel.log 2>&1

and send the file axel.log?

So I entered these lines verbatim into my terminal. The axel.log file produced a file with the single line

malloc(): invalid size (unsorted)

Does the line defining LD_LIBRARY_PATH need to be modified some more? It ends in

ROOTIGNOREPREFIX=1 ROOT_HIST=0 /home/john/ROOT/root_build/bin/root.exe -e 'gDebug=7' -l -q -b

Which doesn’t seem to be library path information.

If this is incorrect, could I please get explicitly the commands that I should be running? Maybe some sort of make command ending in > axel.log 2>&1?

@Axel In case I am misunderstanding and you would just like to see the entire output, from the root_build on my other machine I have run the command

make VERBOSE=1 > axel.log 2>&1

and have attached the output here. Here I haven’t done anything with LD_LIBRARY_PATH.
axel.txt (491.6 KB)
I had run
cp axel.log axel.txt
in order to upload it here.

I should have probably called out that I added the argument -e 'gDebug=7' to the root.exe invocation… I don’t seem to find that in your invocation? That will make the logs way larger btw - if you cannot attach it here, please gzip it and send it to me axel@cern.ch

I think I’m still misunderstanding something. From root_build on the machine where R could not be found, I reran the commands

cmake -DCMAKE_INSTALL_PREFIX=../root_install -Drpath=ON -Dr=ON ../root_src

cmake --build . -- install -j$(nproc)

and then I did

cd lib

LD_LIBRARY_PATH=/home/john/ROOT/root_build/lib:/home/john/ANITA_util_install_dir/lib:/home/john/anitaBuildTool/components/icemc:/home/john/anitaBuildTool/build/components/icemc/:/home/john/ANITA_util_install_dir/lib::/home/john/ANITA_util_install_dir/lib:/home/john/anitaBuildTool/components/icemc:/home/john/anitaBuildTool/build/components/icemc/:/home/john/ANITA_util_install_dir/lib ROOTIGNOREPREFIX=1 ROOT_HIST=0 /home/john/ROOT/root_build/bin/root.exe -e 'gDebug=7' -l -q -b > axel.txt 2>&1

The only output I got from that was a single line of text:
axel.txt (34 Bytes)

I will see if recreating the directories root_build and root_include and then rerunning the above commands changes results, but due to time constraints it will first have to be on the machine where R was found.

EDIT: I have recreated the directories on both machines, but still got the above results.

@vvassilev is there any way we can get info about where this happens / comes from?

So now both my machines have found R as they build, it turns out the one which didn’t was missing either Rcpp or RInside.

Having the same configuration on both machines, I then tried removing the pcm extension files as described here. Doing this I was able to complete the builds on both machines and now am able to access ROOT on both of them.

1 Like

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