Dlopen Error Undefined Symbol
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the dlopen error undefined symbol root workings and policies of this site About Us Learn more about Stack
Dlopen Undefined Symbol C++
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs dlopen failed undefined symbol Documentation Tags Users Badges 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;
Dlopen Error Codes
it only takes a minute: Sign up Receive “undefined symbol” error when loading libary with dlopen up vote 16 down vote favorite 8 I'm writing some code that uses dynamic shared libraries as plugins. My command line for building the shared libraries looks like: cc -shared -fPIC -o module.so -g -Wall module.c Within the module, I can call functions dlopen undefined reference that are in any other shared library that has been loaded within the main executable. However I cannot access (exported) functions that are in the executable itself (I get undefined symbol errors). My call to dlopen looks like this: void *handle = dlopen(plugin, RTLD_NOW); Can anyone please advise how my module can call back to my executable, without having to put all of the executable's utility functions into yet another shared library? shared-libraries dlopen share|improve this question edited Feb 28 '12 at 2:20 sholsapp 4,97433247 asked Jan 26 '09 at 17:29 Alnitak 213k42278351 add a comment| 3 Answers 3 active oldest votes up vote 26 down vote Correct solution is to add -rdynamic to the link command of the main executable. This will add appropriate option to ld (which, when using GNU ld, happens to be --export-dynamic). Adding --export-dynamic directly is technically incorrect: it's a linker option, and so should be added as -Wl,--export-dynamic, or -Wl,-E. This is also less portable than -rdynamic (other linkers have an equivalent, but the option itself is different). share|improve this answ
Canal
.so Undefined Symbol C++
This usually means that you are missing the implementation of one of
Dlopen Header File
your virtual function or that you are missing the dictionary. Cheers, Philippe. On 4/14/11 1:24 PM, Vassili Maroussov wrote: > shared library undefined symbol 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 no idea > what is a reason. http://stackoverflow.com/questions/480617/receive-undefined-symbol-error-when-loading-libary-with-dlopen 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 > g++ -O2 -Wall -fPIC -pthread -m64 -I/usr/local/ROOT/pro/include -c IntKeyList.cpp > https://root.cern.ch/root/roottalk/roottalk11/0572.html 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 /home/vmarouss/ROOTFLUKA/NeuLAND/IntKeyList/./libIntKeyList.so > (int)(-1) > root [1] > > Received on Thu Apr 14 2011 - 20:32:41 CEST This message: [ Message bo
Java, SQL, and other programming languages here. Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... linux operating commands and unix operating commands Linux: dlopen http://www.unix.com/programming/136527-linux-dlopen-fails-find-symbols.html fails to find symbols Programming Thread Tools Search https://gcc.gnu.org/ml/gcc-help/2009-07/msg00349.html this Thread Display Modes #1 05-17-2010 DreamWarrior Registered User Join Date: Oct 2003 Last Activity: 15 February 2013, 11:18 PM EST Posts: 174 Thanks: 1 Thanked 7 Times in 6 Posts Linux: dlopen fails to find symbols I've attached a tar.gz containing three tests to demonstrate the problem I'm having. Within the tar are two undefined symbol shared libraries, two test applications, and a Makefile that builds the three tests. The shared libaries are libshlib1.so and libshlib2.so. Both export a function, libFunc, which takes a char * argument, buf, and returns it after sprintf'ing an id and the integer result of an external function, mainFunc. The code for both is identical except for the id to differentiate. The function, mainFunc, is located in the main binary that links (or dlopens) the dlopen error undefined shared library. The two test applications are test1.c and test2.c. The first, test1.c, simply contains the function mainFunc and calls the library function libFunc. It's really only there to test that the shared library linked normally will find the reference upon load time. This code is compiled to test1. The second, test2.c, is where the problem lies. It is compiled twice, once linking shlib1 (test2) and the second linking nothing (test3). The code uses dlopen to open the second shared library, shlib2, and upon successfully loading the library it calls libFunc as retrieved by dlsym. So...now to the problem. Here is the output of the three executables: Code: >test1 SHLIB1:1 >test2 Loading shared library [./libshlib2.so]...OK. SHLIB2:1 >test3 Loading shared library [./libshlib2.so]...ERROR [./libshlib2.so: undefined symbol: mainFunc] As you can see, test3 fails. However, test2, which is identical to test3 except that it links a different shared libarry than it dlopens, succeeds. Oddly, just linking the other library (shlib1) seems to make the linker decide to "promote" the symbol (mainFunc), making it available to shlib2. However, without that link, test3 fails. Does anyone know why this would be? I compared the output of nm on both test2 and test3 and, except for the addresses, they are identical. I would understand test3 failing if test2 also failed, because neither actually linked the library
dlopen() returns undefined symbol for library w/ RTLD_LAZY From: Davidzeu