# Problem in building ROOT

**URL:** <https://root-forum.cern.ch/t/problem-in-building-root/33481>\
**Category:** Newbie\
**Created:** [April 6, 2019, 5:30pm UTC](https://root-forum.cern.ch/t/problem-in-building-root/33481 "2019-04-06T17:30:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lennart](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/b9bd4f/32.png) [@Lennart](https://root-forum.cern.ch/u/Lennart)\
**Post date:** [April 6, 2019, 5:30pm UTC](https://root-forum.cern.ch/t/problem-in-building-root/33481/1 "2019-04-06T17:30:35Z")

</div>

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!

---

<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:** [April 8, 2019, 12:06pm UTC](https://root-forum.cern.ch/t/problem-in-building-root/33481/2 "2019-04-08T12:06:07Z")

</div>

❗ Read to the end instead of starting to do lots of useless work 🙂

> [@Lennart](#):
>
> …/dictgen/CMakeFiles/Dictgen.dir/src/rootcling\_impl.cxx.o: file not recognized: File truncated

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:

```auto
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](https://root.cern/content/release-61600) 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.
