Please someone shed light on undefined symbol errors
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Please someone shed light on undefined symbol errors
This generally comes from my lack of knowledge on how linux runs apps, but what the hell is an undefined symbol error? It apparently names the offending library and then I do strings and grep for the symbol and sure enough it's there. Ok, then what the hell is complaining about the symbol error? If it doesn't understand where the symbol is coming from, why not freakin ignore it? Why bitch and then quit out? It's almost like it sees something it doesnt recognize and then says, oh shit, i dont know what that is, let's quit fellas. If it isn't gonna need the symbol then ignore it at least. My specific example is on FC5, where I did a "yum install amarok" which installed without a hitch along with several dependency packages. Good, I thought, saves me from havin to deal with it. Then running amarok generates:
amarokapp: symbol lookup error: /usr/lib/libamarok.so.0: undefined symbol: _ZN9KLineEdit13focusOutEventEP11QFocusEvent
?? WTF? I've seen these kinds of errors pop up before and I haven't the faintest clue why an app cares about a symbol it most likely isn't going to use. My solution for these errors was to not use the version of app or in my particular case for clusters, to NOT use latest and greatest RHEL3 patches. Anyways, I hope someone can enlighten me on this.
An "undefined symbol error" means that when Linux tried to load the chunks of software needed, it couldn't find all the expected ingredients. Usually, a program is not 100% self-contained; instead, it makes use of shared libraries. By this means, commonly used code does not have to be duplicated inside every program that wants to make use of it. But if you don't have some needed library installed, Linux will object in the way you've seen. It can't "freakin ignore it", just as you couldn't ignore it if one of the wheels of your car was missing. The complaint happens when something found to be necessary if the program is to continue, is in fact missing. The software author can choose between different behaviours: complain if something that *might* be needed is missing, or complain if something that *is* needed is missing, and presumably had some good reasons for the choice made.
A symbol doesn't necessarily mean a variable, it also (and usually) means a function. That
bizarre-seeming symbol is a reference to a function in an object-oriented language. In such languages there may be many different functions that, in different contexts, have the same name, so the compiler makes each name unique by `mangling' the name -- have a look at the Wikipedia entry on `name mangling' for further details.
So if you're missing some sort of library, how do you find out which one, you may ask? Try using ldd, eg try the command "ldd /bin/ls" to see what the ls command makes use of.
You can also try googling for the symbol! Often, this gets you quickly to information about what it is you're really missing.
Ok, I guess I didnt quite explain that one well enough (thanks beer!). To clarify, I was under the impression that the main program was loading the library (i.e. libamarok.so.0) and encountering the symbol and then exiting because it saw something it didn't recognize. I was mistakenly thinking that the symbol was a function defined and implemented in that library and that for some reason the main program saw it and errored because it didnt make a call to it. After posting, I realized that it was a call to a function defined in another library that's missing. This little bit of understanding will go a long way in helping me troubleshoot issues like this in the future.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.