# When to compile macros

**URL:** <https://root-forum.cern.ch/t/when-to-compile-macros/31792>\
**Category:** Cling\
**Created:** [November 28, 2018, 1:34pm UTC](https://root-forum.cern.ch/t/when-to-compile-macros/31792 "2018-11-28T13:34:49Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [November 28, 2018, 2:49pm UTC](https://root-forum.cern.ch/t/when-to-compile-macros/31792/4 "2018-11-28T14:49:16Z")

</div>

As as side note, this

> [@amarcine](#):
>
> ```auto
> for i in 1 2 3 4 ; do
> root -b -l -q 'macro.C+("'$i'")' >& log.$i.txt &
> done
> 
> ```
> 
> I would get crashes presumably because of the library being rewritten by 4 processes at the same time or maybe because ROOT was unable to decide if it needs to recompile or not.

can be fixed in v5 and v6 with something like:

```auto
root -b -l -q -e '.L macro.C+' >& log.compilation.txt
for i in 1 2 3 4 ; do
  root -b -l -q 'macro.C+("'$i'")' >& log.$i.txt &
done

```

---

_[View the full topic](https://root-forum.cern.ch/t/when-to-compile-macros/31792)._
