Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking shared library to static library

Status
Not open for further replies.

cbnatl

Programmer
Aug 6, 2001
3
US
I am trying to build a shared library in Solaris using Forte C++. I need to be able to link the objects to a static third party library.
ex.
CC -G -o mylib.so -Kpic myfile.o -lsocket -lthread -lpthread -lcurses -lthirdpartystaticlib

If I use the above compiler command, it successfully builds the library. However, I get a library not found exception at runtime. If I do not include the thirdparty library, the shared library successfully builds but I get unresolved external errors at runtime (which I would expect).

I also attempted to remove all of the object files from the third party library and link directly with them rather than linking to their library. This did not work either. Anyone have any ideas?

thanks
Chris
 
cbnatl,

You need to set the LD_LIBRARY_PATH environment variable to point to the directory in which your mylib.so is located. I suspect that the problem is not associated with the third party library.

Hope this helps.

Brudnakm
 
It is set correctly. If I do not link with the Third Party library (which is not a shared library). The library is able to load, but if I link with the static library, then the library is not found (with the same LD_LIBRARY_PATH and location).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top