# Can't load PCM file for static library

**URL:** <https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997>\
**Category:** ROOT\
**Created:** [February 21, 2025, 11:11am UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997 "2025-02-21T11:11:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicola\_Mori](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/nicola_mori/32/23583_2.png) [@Nicola\_Mori](https://root-forum.cern.ch/u/Nicola_Mori)\
**Post date:** [February 21, 2025, 11:11am UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/1 "2025-02-21T11:11:52Z")

</div>

In a third party software there is a static library containing some classes, which I then link to a dynamic library in my project. The static library comes with a PCM file in the `lib` folder of the installation path. My dynamic library is located in a different path, so I added the `lib` folder of the static library to `LD_LIBRARY_PATH` for automatically loading the PCM file when I load my dynamic library. Sadly this doesn’t seem to work:

```auto
$ echo $LD_LIBRARY_PATH 
/home/mori/software/install/KM3NETDATAFORMAT_v3.5.1/lib/:/home/mori/software/install/ROOT_6.26.04/lib:/home/mori/software/install//GIT_2.30.2/lib:/home/mori/software/install//EVENTANALYSIS_1.3.0_ROOT_6.26.04/lib:/home/mori/software/install//EVENTANALYSIS_1.3.0_ROOT_6.26.04/plugin:

$ ls /home/mori/software/install/KM3NETDATAFORMAT_v3.5.1/lib/
G__KM3NeTROOT_rdict.pcm cmake libKM3NeTROOT.a

$ root
root [0] .L Debug/plugin/libKM3NeTDataProviders.so
Error in <TCling::LoadPCM>: ROOT PCM /home/mori/software/KM3/KM3NeTSoftware/Debug/plugin/G__KM3NeTROOT_rdict.pcm file does not exist
Info in <TCling::LoadPCM>: In-memory ROOT PCM candidate /home/mori/software/install/ROOT_6.26.04/lib/libASImageGui_rdict.pcm
  . . . 

```

According to [this post](https://root-forum.cern.ch/t/cannot-find-my-rdict-pcm-files/21901/5) putting the static library `lib` folder in `LD_LIBRARY_PATH` should be sufficient, so I don’t understand what’s wrong.

_ROOT Version:_ 6.26/04  
_Platform:_ ArchLinux  
_Compiler:_ GCC 14.2.1

* * *

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [February 21, 2025, 12:54pm UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/2 "2025-02-21T12:54:33Z")

</div>

Hello @Nicola_Mori,

I see a mismatch in your paths, as your library requires `/home/mori/software/KM3/KM3NeTSoftware/Debug/plugin/G __KM3NeTROOT_rdict.pcm`, which does not exists, while it should ask for `/home/mori/software/install/KM3NETDATAFORMAT_v3.5.1/lib/G__ KM3NeTROOT_rdict.pcm`. Try to rebuild the `.so` file.

Cheers,  
Monica

---

<div class="post-metadata">

**Author:** ![Nicola\_Mori](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/nicola_mori/32/23583_2.png) [@Nicola\_Mori](https://root-forum.cern.ch/u/Nicola_Mori)\
**Post date:** [February 21, 2025, 1:31pm UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/3 "2025-02-21T13:31:23Z")

</div>

Hi Monica,

the first path (`/home/mori/software/KM3/KM3NeTSoftware/Debug/plugin/`) is the one containing my shared library, while the second one (`/home/mori/software/install/KM3NETDATAFORMAT_v3.5.1/lib/`) is the one for the static library holding the dictionaries and for the PCM file. I load my shared library from the first path, and that’s probably the reason why it tries to load the PCM from that path. But when the PCM is not found I’d expect the second folder to be tried, being it specified in `LD_LIBRARY_PATH`, but this is not the case.

Anyway I rebuilt both libraries but as expected this didn’t help.

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [February 21, 2025, 2:03pm UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/4 "2025-02-21T14:03:01Z")

</div>

Just out of curiosity, does it work if you move the pcm in the same directory as the shared library?

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [February 21, 2025, 2:04pm UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/5 "2025-02-21T14:04:41Z")

</div>

Apparently there is a bug in older ROOT versions, see e.g. [this post](https://root-forum.cern.ch/t/pcm-file-not-found/48374). I just noticed you’re using a quite old ROOT version, I would suggest to update your ROOT installation.

---

<div class="post-metadata">

**Author:** ![Nicola\_Mori](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/nicola_mori/32/23583_2.png) [@Nicola\_Mori](https://root-forum.cern.ch/u/Nicola_Mori)\
**Post date:** [February 21, 2025, 2:06pm UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/6 "2025-02-21T14:06:37Z")

</div>

Yes I found that thread after opening this one, so I started to compile 6.34.04. In the meantime you answered me, but now the build is finished and I can confirm that with 6.34.04 the problem is fixed.  
Thank you for your support.

---

<div class="post-metadata">

**Author:** ![Nicola\_Mori](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/nicola_mori/32/23583_2.png) [@Nicola\_Mori](https://root-forum.cern.ch/u/Nicola_Mori)\
**Post date:** [February 21, 2025, 2:17pm UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/7 "2025-02-21T14:17:48Z")

</div>

@mdessole I spoke too fast. After installing 6.34.04 I had an inconsistent environment which for some reason made my test pass. Now I cleaned up and re-set everything, and the error is still there. Copying the PCM file into the folder of the shared library fixes the error; this could be used as a workaround, but I would prefer a proper solution. Do you have any other suggestions?

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [February 21, 2025, 2:25pm UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/8 "2025-02-21T14:25:06Z")

</div>

Unfortunately, I don’t have more suggestions. Maybe @Danilo can help here.

---

<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:** [March 7, 2025, 2:25pm UTC](https://root-forum.cern.ch/t/cant-load-pcm-file-for-static-library/62997/9 "2025-03-07T14:25:10Z")

</div>

Closed on March 7, 2025, 2:25pm UTC

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