ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
I am trying to create a shared library. The library seems to compile and link fine, but at runtime I get an undefined symbol error.
I am trying to link in a static library whose symbol is not found. I tried recompiling the static library with the '-fPIC' option with no luck. Is linking in a static library to a shared library my problem? The static library is compiled with a different version of g++ than the rest of the library. Can this be the cause of the problem? What problems can be anticipated when linking in library that was compiled with a different compiler version?
the libmx.so, libmex.so and libmat.so are all Matlab related, so I assume Matlab somehow takes care of them at runtime. The command does not show the static library I (supposedly) linked in (-lccpl for /usr/lib/libccpl.a), from which I am getting the undefined symbol errors.
When a library is linked statically to your program, its' dependencies are counted as program's dependencies. The thing that may go wrong here is search for the Matlab libraries. Hard to say without knowing the symbol there's problem with. What's the name of it and do you have an idea where it should be found (the static library?)
Thanks for the help Mara. The library I was trying to link in was ccpl http://sourceforge.net/projects/ccpl/ , which I had compiled myself. I found some thread, (which I can't seem to find anymore :P !), that suggested wrapping the link option in two -Wl,option commands, though I don't remember what the option was. It seemed to fix the undefined symbol for ccpl, but I was then getting undefined symbol errors for the pgplot library! I have moved on to a different solution for the libraries I will use...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.