# Installation of ROOT to a user-defined prefix results in broken libraries for external packages (R, cfitsio)

**URL:** <https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361>\
**Category:** ROOT\
**Tags:** installation\
**Created:** [May 11, 2020, 3:32pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361 "2020-05-11T15:32:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 11, 2020, 3:32pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/1 "2020-05-11T15:32:59Z")

</div>

ROOT Version: 6.20.04  
Platform: openSUSE 15.1 / x86\_64  
Compiler: gcc 7.5.0

Dear ROOT Users & Developers,

Further investigation of the issues I reported with regards to building ROOT with R statistics (ROOTR),  
see [Issues when building ROOT with R statistics (ROOTR)](https://root-forum.cern.ch/t/issues-when-building-root-with-r-statistics-rootr/39267)  
did show that the steps I took to successfully build against R lead to ROOTR working from the bin directory of the build tree, while installing ROOT to a user-defined prefix and then executing it from the installation directory resulted in ROOTR failing.

This behavior was confirmed by @wile_e_coyote who also pointed out that this finding was caused by the libraries

```auto
libRInterface.so
libRMVA.so
libRtools.so

```

being broken by (or at least after) installation to a user-defined prefix. Following his approach, I can now confirm that this not only happens on my system for the libraries named above, but it also happens for

```auto
libFITSIO.so

```

All libraries that are broken by installation of ROOT share one common feature: They relate to external packages (R, cfitsio) that I have built and installed (to user-defined prefixes) from source. As these are the only two packages this situation applies to, I cannot tell whether this is a systematic “feature” (bug?) of installing ROOT, but it might hint at an approach for solving this issue.

For the time being, I ended up with a brute-force fix that probably should not be taken: Replacing the named libraries in the installation directory by the ones from the build tree does result in an apparently working installation… 🤔

If I had any decent knowledge of CMake and its install procedure, I would try propose a clean fix, but unfortunately I am lacking the necessary knowledge. I would be happy to hear someone is able to come up with a systematic fix.

Thank you as always, and stay safe,

Wolf

---

<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:** [May 11, 2020, 3:39pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/2 "2020-05-11T15:39:33Z")

</div>

What library is missing for `libFITSIO.so`?

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 11, 2020, 3:49pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/3 "2020-05-11T15:49:30Z")

</div>

```auto
ldd ${ROOTSYS}/lib/libFITSIO.so

```

reports:

```auto
libcfitsio.so.8 => not found

```

---

<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:** [May 11, 2020, 3:54pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/4 "2020-05-11T15:54:53Z")

</div>

Where does it come from for the original library (before “install”)?

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 11, 2020, 3:58pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/5 "2020-05-11T15:58:35Z")

</div>

```auto
ldd <builddir>/lib/libFITSIO.so

```

reports:

```auto
libcfitsio.so.8 => /usr/local/cfitsio-3.47/lib64/libcfitsio.so.8

```

---

<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:** [May 11, 2020, 4:00pm UTC](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 "2020-05-11T16:00:19Z")

</div>

So, try:  
`export LD_LIBRARY_PATH="/usr/local/cfitsio-3.47/lib64:${LD_LIBRARY_PATH}"`

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 11, 2020, 4:09pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/7 "2020-05-11T16:09:31Z")

</div>

I agree with you that this should fix the issue.

However, as stated in my initial post, I opted for the “dirty” solution of replacing libFITSIO.so in the ROOT install directory by the “same” (not really…) file of my ROOT build tree - works…

---

<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:** [May 11, 2020, 4:16pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/8 "2020-05-11T16:16:36Z")

</div>

Maybe you could try a really brutal fix (rebuild ROOT with): `cmake -Drpath=ON ...`

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.

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 11, 2020, 4:22pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/9 "2020-05-11T16:22:44Z")

</div>

I did not consider that flag – are you implying that the behavior I reported as a “issue” is indeed intended? If so, shame on me…

---

<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:** [May 12, 2020, 9:04pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/10 "2020-05-12T21:04:30Z")

</div>

I am a bit surprised that the install is “stripping” some information from the library (as your symptom seems to indicate) but nevermind …

Indeed using `-rpath=ON` is clearly what you want/need in this case as it explicitly says please record the location of the libraries cmake discovered and use those (almost) no matter what.

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 20, 2020, 7:50pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/11 "2020-05-20T19:50:40Z")

</div>

@pcanal and @Wile_E_Coyote: Thank you for pointing me to the `-Drpath=ON` flag.

I followed your advice and rebuilt ROOT yet again using this flag. I can confirm that by enabling the flag, installation to a user-defined prefix does no longer “break” libraries originating from user-built and -installed external packages (i.e. R and cfitsio in my case). Now, ROOT does indeed work from its installation directory and does automatically locate and load all libraries as expected, i.e. also those required for R and cfitsio in my case.

Thank you very much for your help, and please accept my apologies for taking some time to follow your suggestions and reporting back to the forum.

Stay safe,

Wolf

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 20, 2020, 8:05pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/12 "2020-05-20T20:05:03Z")

</div>

@pcanal: While I am very happy that the suggested solution did fix the issue I reported, it made me wonder about the `-Drpath=ON` flag. I went through all of the flags and options listed before my initial build and did not have the impression setting it would be necessary, although it apparently is. In an attempt to learn something, my question is the following:

What is the reason for this flag not to be set as `ON` by default for all ROOT builds, and what are the (unwanted) potential implications of setting it (as I assume it would always be `ON` by default if there was nothing to be worried about)?

I would appreciate if an expert would be willing to share some insight here - who knows when it will come in handy…

Thank you,

Wolf

---

<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:** [May 20, 2020, 8:10pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/13 "2020-05-20T20:10:07Z")

</div>

It is very common to want to build and install ROOT in a set of directories and then tar the result up and install it on a different machine … in a different directory … in that case the rpath information is in the way.

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 20, 2020, 8:16pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/14 "2020-05-20T20:16:42Z")

</div>

Good point, thank you. I did not think of “distributed” installations as this is not relevant to my system-specific installation and use. For those cases, however, it might still seem worthwhile to investigate the initially reported issue of the install “stripping” some information from some of the libraries…

---

<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:** [May 20, 2020, 8:16pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/15 "2020-05-20T20:16:51Z")

</div>

As @pcanal says, consider `-Drpath=ON` as a really brutal fix, needed now.  
Whatever you build against this ROOT version will have all shared libraries’ paths “encoded” by hard.  
As soon as the problem is fixed in the ROOT source code, stop using this fix (and rebuild all your dependent libraries and executables from scratch again).

---

<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:** [May 20, 2020, 8:17pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/16 "2020-05-20T20:17:37Z")

</div>

Can you open a JIRA ticket for the initial problem?

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 20, 2020, 8:17pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/17 "2020-05-20T20:17:55Z")

</div>

Understood & agreed. Wilco

---

<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:** [May 20, 2020, 8:19pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/18 "2020-05-20T20:19:36Z")

</div>

[JIRA -\> ROOT -\> ROOT-10756](https://sft.its.cern.ch/jira/browse/ROOT-10756)

---

<div class="post-metadata">

**Author:** ![Wolfram](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/e68b1a/32.png) [@Wolfram](https://root-forum.cern.ch/u/Wolfram)\
**Post date:** [May 20, 2020, 8:25pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/19 "2020-05-20T20:25:37Z")

</div>

So far, I refrained from opening a ticket as the JIRA system seemed to require an account. As my times as a student at CERN have been over for more than a decade, I do no longer have access to a CERN account.

If it is possible to create an “external” JIRA account (?), I would open a ticket (for the next issue, as apparently @Wile_E_Coyote already opened a ticket for the issue I reported - thank you for that),

---

<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:** [May 20, 2020, 8:32pm UTC](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361/20 "2020-05-20T20:32:30Z")

</div>

If you have not created a [“lightweight” CERN account](https://account.cern.ch/account/) up to now, then hold you breath. There is a plan to drop JIRA completely and switch to “Github Issues”.

[Next page](https://root-forum.cern.ch/t/installation-of-root-to-a-user-defined-prefix-results-in-broken-libraries-for-external-packages-r-cfitsio/39361.md?page=2)
