Unable to load a shared library
Hi,
I am working on an application that links to library libX.so and libY.so. libX.so has some undefined symbols which are defined in libY.so. Compiling the application is fine. But during runtime libX.so fails to load with an error like: Failed to load dynameic library libX. /data/Installs/vip2/libX.so: undefined symbol: _ZN10App7Schemas3Soa8_2006_0310Exceptions12SoaException10setMessageERKSs If this symbol was not found how did application get compile and why is this cribbing now at run time? Any help on this? Thanks, Vipul |
Hi -
Clearly, you need to make sure both shared libraries, libX.so and libY.so, are installed and accessible on your system. They do *not* need to be located in the same place at runtime as they existed at link time (although this is usually the case). Please do this: 1. run "ldd PGMNAME" on the executable that needs these two shared libraries. You can also run "ldd SHOBNAME" on any shared library (to find its runtime dependencies). 2. Copy both libraries to your system (if they're not already there) 3. Define and export "LD_LIBRARY_PATH" (if one or more of your libraries happens to exist in a location different from where "ldd") 4. You should be able to Google for "linux shared library ldd LD_LIBRARY_PATH" for more information, if it's not clear what I'm trying to say. This problem should be pretty easy to resolve - Good luck! Sincerely .. PSM |
Thanks for the reply Paul.
I am still struggling with the issue. 1. The libraries are loaded at runtime. 2. Both the libraries are in place (LD_LIBRARY_PATH out of ques). There are other libraries as well which are being loaded properly from the location. I have execute permission on both libX and libY. Anything else i can try out? -Vipul |
What is the output of the ldd commands? See point 1 in the post by paulsm4 above.
|
The ldd on application's exe does not show dependency on libX and libY. So I think that they are being dynamically loaded.
|
By this I mean that libraries are not statically linked with the exe.
|
But then they *should* show up if/when you query the executable
using ldd ... that's what ldd does, showing which dynamic libs the executable was compiled against. Cheers, Tink |
Now i tried to put -lX in the compiler option and made application working. I did this because I thought that some symbol is undefined, why not statically link this library to the application (I my understanding that this way I am doing static linking is correct)? I went for it it works.
But why did is it not working without this is the real question I am chasing. |
All times are GMT -5. The time now is 05:56 AM. |