Gdb Symbol Lookup Error
Contents |
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
Symbol Lookup Error Undefined Symbol Linux
more about Stack Overflow the company Business Learn more about hiring developers or gdb: symbol lookup error: gdb: undefined symbol: pyunicodeucs4_fromencodedobject posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow undefined symbol pyunicodeucs2_fromencodedobject Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up When look up symbol, the program doesn't search from
Dlopen Undefined Symbol
the correct library up vote 3 down vote favorite I'm adding two classes and libraries to a system, parent.so and child.so deriving from it. The problem is when the program is loading child.so it cannot find parent's virtual function's definition from parent.so. What happens, nm -D child.so will gives something like (I just changed the names) U _ZN12PARENT15virtualFunctionEv The program will crash running _handle = dlopen(filename, RTLD_NOW|RTLD_GLOBAL); //filename is child.so it'll give an error with LD_DEBUG = libs symbol lookup error: undefined symbol: _ZN12PARENT15virtualFunctionEv (fatal) The thing I cannot explain is, I tried LD_DEBUG = symbols using GDB, when running dlopen, the log shows it tried to look up basically in all libaries in the system except parent.so, where the symbol is defined. But from libs log parent.so is already loaded and code is run, and it is at the same path of all other libraries. ...... 27510: symbol=_ZN12PARENT15virtualFunctionEv; lookup in file=/lib/tls/libm.so.6 27510: symbol=_ZN12PARENT15virtualFunctionEv; lookup in file=/lib/tls/libc.so.6 27510: symbol=_ZN12PARENT15virtualFunctionEv; lookup in file=/lib/ld-linux.so.2 27510: child.so: error: symbol lookup error: undefined symbol: _ZN12PARENT15virtualFunctionEv(fatal) How the program or system is managing which library to look for a symbol's definition? I'm new to Linux, can anybody point me some directions to work on? Thanks. EDIT The command used to generate parent.so file is c++ -shared -o parent.so parent.o Similar for child.so. Is any information missing for linking here? Looks like child is only including parent's header file. EDIT2 After another test, calling _handle = dlopen("parent.so", RTLD_NOW|RTLD_GLOBAL); before the crashing line will solve the problem, which I think means originally parent.so was not loaded. But I'm still not very clear about the cause. c++
symbol: _ZN12CppProgramC1EvI searched the internet. Two of the interesting links I found were the following:http://osdir.com/ml/gcc.g++.general/2005-02/msg00061.htmlhttp://www.linuxquestions.org/questions/linux-software-2/undefined-symbol-cout-263568/For me it ended up being a bad LD_LIBRARY_PATH. The path I intended the executable to find it's needed shared library was in the LD_LIBRARY_PATH, it just wasn't before a different path which had an older version of the needed shared library. (This happened to me when I updated by bashrc with a library path and http://stackoverflow.com/questions/12945514/when-look-up-symbol-the-program-doesnt-search-from-the-correct-library just re-sourced it).Some cool commands in the debugging process:ldd TestCppProgram (Shows you where your program is getting it's libraries from. An early-on careful inspection of this would've quickly let me to my problem!)ldd -d -r TestCppProgram (Shows you any undefined symbols. There shouldn't be any undefined symbols for an executable, but there will http://gdwarner.blogspot.com/2009/03/c-runtime-symbol-lookup-error.html be for a shared lib if it depends on another shared lib. Somebody please correct me if I'm wrong)nm TestCppProgram | c++filt (displays unmangled symbol information)nm TestCppProgram (Displays mangled symbol information. Ie: You should be able to find stuff like ZN12CppProgramC1Ev in here. In my problem above, I found which line number the undefined symbol in question was on, and then looked it up in the unmangled version to see what function it was trying to resolve. It let me know, but it didn't really help me find out what my problem was.)readelf -d TestCppProgram (Shows library dependencies. similar to ldd.) Posted by Greg at 12:30 PM 10 comments: trinity said... Hey I had forgotten to write a destructor..nm with c++filt is awesome!Just the thing I neededThanks.. :) 6/11/2009 12:06 AM admorgan said... nm -C does the same as filtering through c++filt 11/03/2009 12:21 PM Kevin said... great post, you saved the day for me to
Search [Solved]undefined symbol: _ZN9QListData11detach_growEPii sujoykroy Posts: 3 Joined: Tue Jul 12, 2011 5:37 am Tue Jul 12, https://lmms.io/forum/viewtopic.php?t=338 2011 6:02 am by sujoykroy » Tue Jul 12, 2011 6:02 am hi, i built lmms from source, but could not make it run. when running lmms from terminal, i'm getting followingCode: Select all[sujoy@localhost ~]$ lmms
Using SSE optimized routines
Using SSE2 optimized routines
Notice: could not set realtime priority.
lmms: symbol undefined symbol lookup error: lmms: undefined symbol: _ZN9QListData11detach_growEPii
and as i tried to debug it using gdb, it shows these, --Code: Select all[root@localhost build]# gdb /usr/local/bin/lmms
GNU gdb (GDB) Fedora (7.0-3.fc12)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are symbol lookup error free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /usr/local/bin/lmms...done.
(gdb) run
Starting program: /usr/local/bin/lmms
warning: .dynamic section for "/lib/libc.so.6" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
[Thread debugging using libthread_db enabled]
Using SSE optimized routines
Using SSE2 optimized routines
Detaching after fork from child process 24960.
warning: .dynamic section for "/usr/lib/libwacomcfg.so.0" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dynamic section for "/usr/lib/libgdk_pixbuf-2.0.so.0" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dynamic section for "/lib/libgio-2.0.so.0" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
warning: .dyna