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

**URL:** <https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732>\
**Category:** ROOT\
**Created:** [September 27, 2022, 11:58pm UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732 "2022-09-27T23:58:43Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [September 27, 2022, 11:58pm UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/1 "2022-09-27T23:58:43Z")

</div>

* * *

_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”](https://root.cern/install/), 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

```auto
cmake -DCMAKE_INSTALL_PREFIX=../root_install -Dr=ON ../root_src

```

and then

```auto
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

```auto
[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

```auto
[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](https://root-forum.cern.ch/t/wsl-build-from-source-error-rint-pcm-is-out-of-date-cannot-read-module-signature/47564), 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!

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [September 28, 2022, 1:21am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/2 "2022-09-28T01:21:04Z")

</div>

Since posting this message, I have found [this message](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/6). I am seeing if issuing the command

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

```

then issuing the command

```auto
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

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

```

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

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [September 28, 2022, 2:24am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/3 "2022-09-28T02:24:14Z")

</div>

So issuing the command

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

```

followed by

```auto
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

```auto
[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

```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 28, 2022, 6:58am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/4 "2022-09-28T06:58:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [September 28, 2022, 7:15am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/5 "2022-09-28T07:15:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [September 28, 2022, 8:16am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/6 "2022-09-28T08:16:40Z")

</div>

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

```auto
[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

```

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [September 28, 2022, 10:38am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/7 "2022-09-28T10:38:30Z")

</div>

Thanks. So

```auto
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

```auto
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`?

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [September 28, 2022, 4:56pm UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/8 "2022-09-28T16:56:36Z")

</div>

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

```auto
malloc(): invalid size (unsorted)

```

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

```auto
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`?

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [September 28, 2022, 11:01pm UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/9 "2022-09-28T23:01:01Z")

</div>

@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

```auto
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](https://root-forum.cern.ch/uploads/short-url/lvgENggMb9bYE7eTYoMA44wZej4.txt) (491.6 KB)  
I had run  
`cp axel.log axel.txt`  
in order to upload it here.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [October 3, 2022, 7:14am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/10 "2022-10-03T07:14:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [October 3, 2022, 5:54pm UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/11 "2022-10-03T17:54:48Z")

</div>

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

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

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

```

and then I did

```auto
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](https://root-forum.cern.ch/uploads/short-url/yntuyleI1zwGhw48MPypkFZir9z.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.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [October 4, 2022, 7:09am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/12 "2022-10-04T07:09:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jwruss](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@jwruss](https://root-forum.cern.ch/u/jwruss)\
**Post date:** [October 6, 2022, 8:23am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/13 "2022-10-06T08:23:13Z")

</div>

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](https://root-forum.cern.ch/t/wsl-build-from-source-error-rint-pcm-is-out-of-date-cannot-read-module-signature/47564/18). Doing this I was able to complete the builds on both machines and now am able to access ROOT on both of them.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [October 20, 2022, 8:23am UTC](https://root-forum.cern.ch/t/building-root-6-26-06-from-source-with-r-bindings-enabled-on-ubuntu-20-04-or-22-04/51732/14 "2022-10-20T08:23:26Z")

</div>

Closed on October 20, 2022, 8:23am UTC

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