Dlopen Error .so Undefined Symbol
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies dlopen error undefined symbol root of this site About Us Learn more about Stack Overflow the company
Dlopen Undefined Symbol C++
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges dlopen failed undefined symbol Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:
Error Undefined Reference To Dlopen
Sign up dlopen - Undefined symbol error up vote 3 down vote favorite 1 I'm using dlopen to load a shared library at run time dlopen("SharedLibarary1.so", RTLD_NOW | RTLD_GLOBAL); In that shared object I refer to a const char* defined in another shared library "SharedLibarary2.so". The Executable, and both the libraries are built using -rdynamic. But I still get the run time dlopen undefined reference error when using dlopen: "/usr/lib/SharedLibarary1.so: undefined symbol" and points to the mangled const char* has the undefined symbol. Whith GDB "info share" I can see that the second library is not loaded at the point of the error. How ever that problem goes away if I do a dlopen on the second library before I do on the first library. Is there a better way to force the loader to load the second library for the unresolved symbol? c++ c linux dlopen shared-libraries share|improve this question edited Oct 19 '12 at 13:59 Sam Miller 18.1k34373 asked Oct 19 '12 at 13:47 Sak 12929 1 yes. Don't make the library you load rely on something that will only be linked in by another library that you will load using dlopen(). Use a shared object that is loaded the regular way that has that symbol. Does using RTLD_LAZY help by the way? –CashCow Oct 19 '12 at 13:56 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted When building a shared library, you can link another inside, e.g. like gc
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the
.so Undefined Symbol C++
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Dlopen Header File
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million shared library undefined symbol programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Undefined symbol when trying to load a library with dlopen up vote 7 down vote favorite 3 I'm trying to http://stackoverflow.com/questions/12975673/dlopen-undefined-symbol-error load a shared library (plugin) I was provided (closed source) with dlopen under a Linux ARM platform. I'm trying to load this way: void* handle = dlopen(/, RTLD_NOW); The result is a failure with this message: Failed to load /: undefined symbol: . I tried to look inside the library with nm, but it seems the lib was stripped, no symbol could be found. I also tried using readelf -s, and, in fact, http://stackoverflow.com/questions/8364550/undefined-symbol-when-trying-to-load-a-library-with-dlopen I got this result: 12663: 00000000 0 NOTYPE GLOBAL DEFAULT UND By reading around, I get that readelf -s returns all the symbols, including those symbols defined in libraries referenced by it. The answers to this question are not completely clear to me: is this a symbol which is supposed to be in the library and which is not there because it was compiled the wrong way or is this a symbol I'm supposed find somewhere else? The output of readelf -d seems to suggest I'm providing all the needed shared libraries. May this error be related to a mistake in the way I'm compiling my executable or is this something not related to the loader? Also, I read about the meaning of each column, but those values are quite strange. How do you interpret that symbol description? Why is address 0? Why is type NOTYPE? c++ compilation linker shared-libraries dlopen share|improve this question asked Dec 3 '11 at 0:50 Luca Carlon 5,54563469 2 Use nm -D instead of just nm. –n.m. Dec 3 '11 at 0:53 Are you specifically supposed to use RTLD_NOW? Otherwise, you may just need to switch to RTLD_LAZY. –David Schwartz Dec 3 '11 at 0:57 @n.m.: Arg! I really didn't know that. The symbol is listed
Canal Date: Thu, 14 Apr 2011 13:32:35 -0500 Hi Vassili, $ echo _ZTV10IntKeyCntr | https://root.cern.ch/root/roottalk/roottalk11/0572.html c++filt vtable for IntKeyCntr This usually means that you are missing the implementation of one of your virtual function or that you are missing the dictionary. Cheers, Philippe. On 4/14/11 1:24 PM, Vassili Maroussov wrote: > Dear ROOTers, > > I'm getting the "undefined symbol:"error while trying to load in ROOT session a library with 2 very simple classes. I have undefined symbol no idea > what is a reason. File are attached, the session log is below. Can someone help me? > > Regards, > > Vassili > > ----------------------- > [vmarouss_at_Ezhik-HDX18 IntKeyList]$ > [vmarouss_at_Ezhik-HDX18 IntKeyList]$ uname -a > Linux Ezhik-HDX18 2.6.35.12-88.fc14.x86_64 #1 SMP Thu Mar 31 21:21:57 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux > [vmarouss_at_Ezhik-HDX18 IntKeyList]$ make clean > [vmarouss_at_Ezhik-HDX18 IntKeyList]$ make .so undefined symbol > g++ -O2 -Wall -fPIC -pthread -m64 -I/usr/local/ROOT/pro/include -c IntKeyList.cpp > Generating dictionary IntKeyListDict.cpp... > IntKeyListDict.cpp done > g++ -O2 -Wall -fPIC -pthread -m64 -I/usr/local/ROOT/pro/include -c IntKeyListDict.cpp > g++ -shared -O2 -Wall -fPIC -pthread -m64 -I/usr/local/ROOT/pro/include IntKeyList.o IntKeyListDict.o -L/usr/local/ROOT/pro/lib > -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread > -lm -ldl -rdynamic -o libIntKeyList.so > libIntKeyList.so done > [vmarouss_at_Ezhik-HDX18 IntKeyList]$ root > ******************************************* > * * > * W E L C O M E to R O O T * > * * > * Version 5.28/00b 14 March 2011 * > * * > * You are welcome to visit our Web site * > * http://root.cern.ch * > * * > ******************************************* > > ROOT 5.28/00b (branches/v5-28-00-patches_at_38394, Apr 14 2011, 17:55:00 on linuxx8664gcc) > > CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010 > Type ? for help. Commands must be C++ statements. > Enclose multiple statements between { }. > root [0] gSystem->Load("libIntKeyList") > dlopen error: /home/vmarouss/ROOTFLUKA/NeuLAND/IntKeyList/./libIntKeyList.so: undefined symbol: _ZTV10IntKeyCntr > Load Error: Failed to load Dynamic link library