Root Installation, need '-ldl'?


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/
/lib/…/lib/libpythia8.a(PartonDistributions.o): In function Pythia8::LHAPDF::symbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': undefined reference todlsym’ undefined reference to dlerror' undefined reference todlerror’
/lib/…/lib/libpythia8.a(PartonDistributions.o): In function Pythia8::LHAPDF::~LHAPDF()': undefined reference todlclose’ undefined reference to dlerror' /lib/../lib/libpythia8.a(PartonDistributions.o): In functionPythia8::LHAPDF::LHAPDF(int, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, Pythia8::Info*)’: undefined reference to dlerror' undefined reference todlopen’ undefined reference to `dlerror’
collect2: error: ld returned 1 exit status
montecarlo/pythia8/CMakeFiles/EGPythia8.dir/build.make:174: recipe for target ‘lib/’ failed
make[2]: *** [lib/] 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?


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

Thank you for your answer :smiley:

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.