# Load Library bug or quirk

**URL:** <https://root-forum.cern.ch/t/load-library-bug-or-quirk/38900>\
**Category:** ROOT\
**Created:** [April 15, 2020, 3:39pm UTC](https://root-forum.cern.ch/t/load-library-bug-or-quirk/38900 "2020-04-15T15:39:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![whit2333](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/whit2333/32/16624_2.png) [@whit2333](https://root-forum.cern.ch/u/whit2333)\
**Post date:** [April 15, 2020, 3:39pm UTC](https://root-forum.cern.ch/t/load-library-bug-or-quirk/38900/1 "2020-04-15T15:39:13Z")

</div>

Hello,

`R__LOAD_LIBRARY` and `gSystem-Load()` both ignore `LD_LIBRARY_PATH` and load the libraries from the same directory as the root libraries (`/usr/local/lib` in this case).

This seems like a bug but I am not 100% sure.

See my post here for more details

> <https://github.com/AIDASoft/DD4hep/issues/665#issuecomment-614110557>
>
> Hello,
> When loading from a compiled root script the detector library under development is not found. In this case we are developing...

Cheers

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 15, 2020, 4:53pm UTC](https://root-forum.cern.ch/t/load-library-bug-or-quirk/38900/2 "2020-04-15T16:53:24Z")

</div>

@Axel For me, it’s a bug.

The problem is that ROOT “prepends” its own “`root-config --libdir`” to the list of searched directories from the “`LD_LIBRARY_PATH`” (and then appends the “`.`” directory).  
You can easily see it, just try: `gSystem->Load("NonExistent");`

I would really prefer to have “`.:${LD_LIBRARY_PATH}:/anything:/else:/useful`” (where “`LD_LIBRARY_PATH`” is exactly what the user provided, without ANY modifications).

This is actually a bug in the “root” executable, which internally modifies its own “`LD_LIBRARY_PATH`” value:  
`std::cout << gSystem->ExpandPathName("${LD_LIBRARY_PATH}") << std::endl;`

For the time being, this does NOT happen if you use the “root.exe” executable, though. So, running “root.exe” (instead of “root”) is a possible brutal fix.

You can also try to apply another brutal fix (in your “`rootlogon.C`” file):  
`gSystem->SetDynamicPath(TString::Format("/my/preferred/path:%s", gSystem->GetDynamicPath()));`

BTW. [You should NEVER install ROOT into “standard” system directories.](https://root-forum.cern.ch/t/missing-canvas/17664/17)

---

<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 20, 2020, 2:18pm UTC](https://root-forum.cern.ch/t/load-library-bug-or-quirk/38900/3 "2020-04-20T14:18:04Z")

</div>

Thanks for your bug report [https://sft.its.cern.ch/jira/browse/ROOT-10697](https://sft.its.cern.ch/jira/browse/ROOT-10697) !

---

<div class="post-metadata">

**Author:** ![whit2333](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/whit2333/32/16624_2.png) [@whit2333](https://root-forum.cern.ch/u/whit2333)\
**Post date:** [April 22, 2020, 4:11pm UTC](https://root-forum.cern.ch/t/load-library-bug-or-quirk/38900/4 "2020-04-22T16:11:47Z")

</div>

@Wile_E_Coyote,

Thanks for the info.

In my case, the root installation is inside a container so there is only ever one version of root. Would you still recommend never installing into /usr/local?

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 22, 2020, 6:14pm UTC](https://root-forum.cern.ch/t/load-library-bug-or-quirk/38900/5 "2020-04-22T18:14:09Z")

</div>

If you are happy with separate / different “containers” for different ROOT versions then you don’t need to care where you install it.

---

<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:** [May 6, 2020, 6:14pm UTC](https://root-forum.cern.ch/t/load-library-bug-or-quirk/38900/6 "2020-05-06T18:14:18Z")

</div>

Closed on May 6, 2020, 6:14pm UTC

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