/home/wolfgang/BINP/Diploma/Analysis/omega_pi0/Algorithm/XML_Parser_cpp_ACLiC_dict.o: In function GetCuts(float)': XML_Parser_cpp_ACLiC_dict.cxx:(.text+0x217): undefined reference to pugi::xml_document::xml_document()’
Info in TUnixSystem::ACLiC: creating shared library /home/wolfgang/BINP/Diploma/Analysis/omega_pi0/Algorithm/./XML_Parser_cpp.so
/usr/bin/ld: /usr/local/lib/libpugixml.a(pugixml.cpp.o): relocation R_X86_64_32 against `.rodata’ can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpugixml.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Error in : Compilation failed!
You need to recompile “libpugixml” adding “-fPIC” (even though it is an archive library), if you want to use it in dynamically linked shared objects.
Otherwise you will need to build your own standalone executables (linking them to your “libpugixml.a” as is).
I am afraid static libraries can’t be dynamically loaded.
That’s just the way it is.
For a library to be dlopen’ed (what is happening when you load it from the ROOT prompt) it need to be compiled in a special way.
A .a library isn’t a .so library.
Recompile it to make it a shared library as indicated by the error message.
Thank you all so much. Finally, I have made it work.
For those people who do not know much about cmake, make, ... (like me) I provide a solution that I found how to recompile library with -fPIC option (assuming using of cmake):
Just add these lines to your CMakeLists.txt: