# Error loading shared library: libGarf3d.so

**URL:** <https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838>\
**Category:** ROOT\
**Created:** [September 15, 2015, 8:36am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838 "2015-09-15T08:36:00Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![VARUN\_BAHAL](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/5f9b8f/32.png) [@VARUN\_BAHAL](https://root-forum.cern.ch/u/VARUN_BAHAL)\
**Post date:** [September 15, 2015, 8:36am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/1 "2015-09-15T08:36:00Z")

</div>

Hello root user,

I have a program . It is compiled without any problem. while running i get the following error.

error while loading shared libraries: libGraf3d.so: cannot open shared object file: No such file or directory

file libGraf3d.so is related to root. It is there in my system. I read on some other website that this problem can arise if you have installed a program many times and there are many versions of such files on system. Then operating system can not decide which file to link to during runtime.

i have many versions of this file.

```auto

./usr/local/lib/root/libGraf3d.so
./usr/lib/x86_64-linux-gnu/root5.34/libGraf3d.so
./usr/lib/x86_64-linux-gnu/root5.34/libGraf3d.so.5.34
./usr/lib/x86_64-linux-gnu/root5.34/libGraf3d.so.5
./usr/lib/x86_64-linux-gnu/libGraf3d.so.5.34

```

How can i remove these different versions without damaging my system ?  
or

There is something else causing the problem ?

Any one Help Please .

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 15, 2015, 12:27pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/2 "2015-09-15T12:27:03Z")

</div>

Does your LD\_LIBRARY\_PATH environment variable point to the place where this library sits ?

---

<div class="post-metadata">

**Author:** ![VARUN\_BAHAL](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/5f9b8f/32.png) [@VARUN\_BAHAL](https://root-forum.cern.ch/u/VARUN_BAHAL)\
**Post date:** [September 16, 2015, 5:44am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/3 "2015-09-16T05:44:49Z")

</div>

Hi couet,

Thanks for the reply. 🙂

LD\_LIBRARY\_PATH did not include the path of file. Now I have included this in my bashrc. It works.

🙂😃

Can you please tell a method to remove other versions of this file ? Actually i have mistakenly installed two versions of root ( 5.34 and 6.04 ). I would like to remove one of it . do you know a clean method ?

Varun

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [September 16, 2015, 7:15am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/4 "2015-09-16T07:15:25Z")

</div>

Simply remove (rm) those you do not need.

---

<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:** [September 16, 2015, 8:54am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/5 "2015-09-16T08:54:11Z")

</div>

> [@Missing Canvas](https://root-forum.cern.ch/t/missing-canvas/17664/17):
>
> Honestly speaking, sooner or later, you will learn by hard that the policy of using a “system-provided” ROOT version (e.g. in “/usr/[bin|lib]” or “/usr/local/[bin|lib]”) is a dead end. You will learn that you need something like three different versions of ROOT - just because something that works with a particular ROOT version is not working with another ones, or because some piece of your additional, experiment / analysis specific, software explicitly requires a particular ROOT version. The s…

---

<div class="post-metadata">

**Author:** ![VictorM](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/victorm/32/36543_2.png) [@VictorM](https://root-forum.cern.ch/u/VictorM)\
**Post date:** [June 11, 2024, 10:12am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/6 "2024-06-11T10:12:25Z")

</div>

Hey,  
could you please provide info how you did that?  
I’m facing the ssam eproblem now but although I set the path to the file, it doesn’t work. Maybe I did something wrong. Thank you so much

This is what I included in the .bashrc:  
LD\_LIBRARY\_PATH=/home/me/packages/usr/lib/root/libGraf3d.so  
export LD\_LIBRARY\_PATH

Note: I’m trying to use Garfield++ on a linux remote server.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 11, 2024, 11:18am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/7 "2024-06-11T11:18:41Z")

</div>

Try:

```auto
LD_LIBRARY_PATH=/home/me/packages/usr/lib/root/
export LD_LIBRARY_PATH

```

---

<div class="post-metadata">

**Author:** ![VictorM](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/victorm/32/36543_2.png) [@VictorM](https://root-forum.cern.ch/u/VictorM)\
**Post date:** [June 11, 2024, 11:27am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/8 "2024-06-11T11:27:05Z")

</div>

Thanks for your reply! 🙂  
It still does not work…

I sourced the bashrc, recompiled… Something else I could have missed?  
Thanks again

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 11, 2024, 12:24pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/9 "2024-06-11T12:24:56Z")

</div>

May be explain with more details what you are doing.

---

<div class="post-metadata">

**Author:** ![VictorM](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/victorm/32/36543_2.png) [@VictorM](https://root-forum.cern.ch/u/VictorM)\
**Post date:** [June 11, 2024, 12:37pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/10 "2024-06-11T12:37:23Z")

</div>

Okay, here we go. I really appreciate your help.

I’m on a ubuntu remote machine, no sudo privileges.  
I downloaded, compiled and installed Garfield++ garfieldpp.web.cern.ch/garfieldpp/ according to the instructions.

I cloned a working code from my local machine and compiled it succesfully (pp.cc → pp).  
When I do ./pp, I get the error:  
./pp: error while loading shared libraries: libGraf3d.so: cannot open shared object file: No such file or directory

The same errors occurs for every Garfield++ simulation I want to run.

find . -iname libGraf3d\* gives: (./ is /home/me)  
./packages/usr/lib/root/libGraf3d.rootmap  
./packages/usr/lib/root/libGraf3d.so  
./packages/usr/lib/root/libGraf3d\_rdict.pcm

in the root directory, the libGraf3d.so appears in red.  
“ls -l” gives:  
-rw-r–r-- 1 victor victor 14341 Jan 29 01:46 libGraf3d\_rdict.pcm  
-rw-r–r-- 1 victor victor 1128 Jan 29 01:46 libGraf3d.rootmap  
lrwxrwxrwx 1 victor victor 17 May 12 08:11 libGraf3d.so → libGraf3d.so.6.26’

I removed other libGraf3d.so.X.XX following the previous comments here.

I don’t know… do you have an idea what I did wrong?

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 11, 2024, 12:45pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/11 "2024-06-11T12:45:23Z")

</div>

It looks like an issue with Garfield. Lets ask @hschindl for help.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [June 11, 2024, 3:24pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/12 "2024-06-11T15:24:04Z")

</div>

Hi,  
did you source the ` thisroot.sh` and `setupGarfield.sh` scripts before running CMake and make for your application?

---

<div class="post-metadata">

**Author:** ![VictorM](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/victorm/32/36543_2.png) [@VictorM](https://root-forum.cern.ch/u/VictorM)\
**Post date:** [June 18, 2024, 1:00pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/13 "2024-06-18T13:00:17Z")

</div>

Thank you for your reply!

yes, I sourced both of it.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [June 20, 2024, 11:17am UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/14 "2024-06-20T11:17:04Z")

</div>

Can you provide more details and/or instructions such that I can try to reproduce this issue?

---

<div class="post-metadata">

**Author:** ![VictorM](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/victorm/32/36543_2.png) [@VictorM](https://root-forum.cern.ch/u/VictorM)\
**Post date:** [June 20, 2024, 1:45pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/15 "2024-06-20T13:45:44Z")

</div>

Well, I now have libGraf3d.so at ./packages/root/lib/libGraf3d.so. So it is existent.

I’m now working with a fresh garfieldpp clone. For example, when trying to run the Gem example, I simply  
source /home/me/packages/root/bin/thisroot.sh  
source $GARFIELD\_HOME/install/share/Garfield/setupGarfield.sh  
LD\_LIBRARY\_PATH=/home/me/packages/root/  
export LD\_LIBRARY\_PATH  
cmake …  
make  
./gem

Output:  
./gem: error while loading shared libraries: libGraf3d.so: cannot open shared object file: No such file or directory

Together with the additional information given above, I don’t know what else to tell you…

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [June 20, 2024, 2:17pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/16 "2024-06-20T14:17:09Z")

</div>

Can you try without these two lines?

```auto
LD_LIBRARY_PATH=/home/me/packages/root/
export LD_LIBRARY_PATH

```

Setting up the relevant environment variables should be taken care of by the `thisroot.sh` and `setupGarfield.sh` scripts

---

<div class="post-metadata">

**Author:** ![VictorM](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/victorm/32/36543_2.png) [@VictorM](https://root-forum.cern.ch/u/VictorM)\
**Post date:** [August 1, 2024, 12:21pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/17 "2024-08-01T12:21:11Z")

</div>

Also without those lines, it does not work with the same output.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [August 6, 2024, 3:50pm UTC](https://root-forum.cern.ch/t/error-loading-shared-library-libgarf3d-so/19838/18 "2024-08-06T15:50:33Z")

</div>

Can you try from a fresh clone (of Garfield++) and post the step-by-step commands that you typed?
