Problem in building ROOT

Hello,
I’m a physics student who wants and needs to learn how to use ROOT! I’m on a virtual machine where the host OS is Windows and the virtual one is Ubuntu 18.04.2 64 bit.
I’ve been trying to build ROOT for some time now, but somehow it doens’t work.
This is a copy of the terminal while doing the build itself. I’ve done it by copying the GitHub file and installing CMake before hand.

[ 73%] Linking CXX executable src/rootcling_stage1
…/dictgen/CMakeFiles/Dictgen.dir/src/rootcling_impl.cxx.o: file not recognized: File truncated
collect2: error: ld returned 1 exit status
core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/build.make:212: recipe for target ‘core/rootcling_stage1/src/rootcling_stage1’ failed
make[2]: *** [core/rootcling_stage1/src/rootcling_stage1] Error 1
CMakeFiles/Makefile2:19167: recipe for target ‘core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/all’ failed
make[1]: *** [core/rootcling_stage1/CMakeFiles/rootcling_stage1.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
[ 73%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingTypeInfo.cxx.o
[ 73%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingValue.cxx.o
[ 74%] Built target MetaCling
Makefile:151: recipe for target ‘all’ failed
make: *** [all] Error 2

I hope what I said makes some sense!

:exclamation: Read to the end instead of starting to do lots of useless work :slight_smile:

That’s typical when:

  • you ran out of disk space (unlikely)
  • you ran out of memory (much more likely)

Here is the remedy:

  1. shutdown your VM, increase its RAM to >= 4GB
  2. use the gold linker (see below)
  3. rm core/dictgen/CMakeFiles/Dictgen.dir/src/rootcling_impl.cxx.o
  4. make -j 4 instead of too many concurrent compilations - especially too many linker invocations eat up a lot of RAM

gold uses much less RAM. On Ubuntu, activate it like this:

update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
update-alternatives --config ld

Of course the easiest is to just take the binaries we provide! Get them at Release 61600 - ROOT e.g. for your Ubuntu 18.04: untar (tar xzf root_v6.16.00.Linux-ubuntu18-x86_64-gcc7.3.tar.gz) and set it up like this: . root-.../bin/thisroot.sh That’s so much faster!

Cheers, Axel.