This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Query related to library linking.
- From: "Tayade, Nilesh" <Nilesh dot Tayade at netscout dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 20 Aug 2012 04:53:37 +0000
- Subject: Query related to library linking.
Hi,
I have a basic query related to linking of static and dynamic libraries.
My program needs to use 'libcrypto', libssl and libnetsnmp libraries.
Out of these, the libnetsnmp and libssl have dependency on libcrypto.
For some reason, I need to link the libcrypto and libssl statically to my program.
So I have built libcrypto.a and libssl.a and I am able to link them correctly.
But when libnetsnmp gets linked, since it is a shared object, it also links libcrypto.so.
So why should libnetsnmp again try to link libcrypto.so when the symbols are already resolved while statically linking libcrypto.a?
Is there some way to avoid it? I tried using -static and -Bstatic.
Any advice on this will be appreciated.
--
Thanks,
Nilesh
P.S. : I tried looking for any clue in archives. Please redirect me to the link, if such queries are already answered.