# Root Installation, need '-ldl'?

**URL:** <https://root-forum.cern.ch/t/root-installation-need-ldl/32231>\
**Category:** Newbie\
**Created:** [January 10, 2019, 3:52am UTC](https://root-forum.cern.ch/t/root-installation-need-ldl/32231 "2019-01-10T03:52:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shimperator](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shimperator/32/22840_2.png) [@shimperator](https://root-forum.cern.ch/u/shimperator)\
**Post date:** [January 10, 2019, 3:52am UTC](https://root-forum.cern.ch/t/root-installation-need-ldl/32231/1 "2019-01-10T03:52:21Z")

</div>

Hello,

I am a newbie who is installing ROOT for a week already and  
still not so successful.  
I was just following the instruction of the website and “README/INSTALL”.  
But ‘make’ always failed at build [95%] level with such error messages:  
[95%] Linking CXX shared library …/…/lib/libEGPythia8.so  
/lib/…/lib/libpythia8.a(PartonDistributions.o): In function `Pythia8::LHAPDF::symbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': PartonDistributions.cc:(.text+0xdb68): undefined reference to`dlsym’  
PartonDistributions.cc:(.text+0xdb70): undefined reference to `dlerror' PartonDistributions.cc:(.text+0xdbf3): undefined reference to`dlerror’  
/lib/…/lib/libpythia8.a(PartonDistributions.o): In function `Pythia8::LHAPDF::~LHAPDF()': PartonDistributions.cc:(.text+0x13b7b): undefined reference to`dlclose’  
PartonDistributions.cc:(.text+0x13b80): undefined reference to `dlerror' /lib/../lib/libpythia8.a(PartonDistributions.o): In function`Pythia8::LHAPDF::LHAPDF(int, std::\_\_cxx11::basic\_string\<char, std::char\_traits, std::allocator \>, Pythia8::Info\*)’:  
PartonDistributions.cc:(.text+0x13f4b): undefined reference to `dlerror' PartonDistributions.cc:(.text+0x141f1): undefined reference to`dlopen’  
PartonDistributions.cc:(.text+0x141fd): undefined reference to `dlerror’  
collect2: error: ld returned 1 exit status  
montecarlo/pythia8/CMakeFiles/EGPythia8.dir/build.make:174: recipe for target ‘lib/libEGPythia8.so’ failed  
make[2]: \*\*\* [lib/libEGPythia8.so] Error 1  
CMakeFiles/Makefile2:18833: recipe for target ‘montecarlo/pythia8/CMakeFiles/EGPythia8.dir/all’ failed  
make[1]: \*\*\* [montecarlo/pythia8/CMakeFiles/EGPythia8.dir/all] Error 2  
Makefile:149: recipe for target ‘all’ failed  
make: \*\*\* [all] Error 2

I googled this and found some suggestions to add “-ldl” to LDFLAGS. And I added “-ldl” to etc/MakeFile/arch.  
But the problem is not solved.

Do you have any suggestion to do for solving this?

Thanks!

---

<div class="post-metadata">

**Author:** ![shimperator](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shimperator/32/22840_2.png) [@shimperator](https://root-forum.cern.ch/u/shimperator)\
**Post date:** [January 10, 2019, 4:43am UTC](https://root-forum.cern.ch/t/root-installation-need-ldl/32231/2 "2019-01-10T04:43:08Z")

</div>

‘-ldl’ fixed the problem. I changed LDFLAGS not CLDFLAGS and compiled cmake.

Thank you for your answer 😃

---

<div class="post-metadata">

**Author:** ![amadio](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/amadio/32/12562_2.png) [@amadio](https://root-forum.cern.ch/u/amadio)\
**Post date:** [January 10, 2019, 7:43am UTC](https://root-forum.cern.ch/t/root-installation-need-ldl/32231/3 "2019-01-10T07:43:24Z")

</div>

When using static libraries (like you use for Pythia), the dependencies (e.g. libdl) of the static library have to be propagated to the library linking against it (in this case libEGPythia8 in ROOT) since they are not linked to the static library itself. I think the best option in your case would be to just use shared libraries for Pythia8.
