[clue-tech] Forcing gcc compiler to link against specific so library?

Jim Ockers ockers at ockers.net
Thu Jan 5 18:16:39 MST 2006


Hi,

Does anyone know how to force the linker/dynamic loader to use a
specific (older) version of a library when two versions are present
on the compiler system?

We compile an application that has -lcrypto in the compiler/linker
command line.  It is dynamically linked.  The development systems
have these libcrypto:

-rwxr-xr-x    1 root     root       918752 Sep  7  2001 /lib/libcrypto.so.0.9.6b
-rwxr-xr-x    1 root     root      1118600 Mar 11  2005 /lib/libcrypto.so.0.9.7a
lrwxrwxrwx    1 root     root           19 Jun 14  2004 /lib/libcrypto.so.2 -> libcrypto.so.0.9.6b
lrwxrwxrwx    1 root     root           19 Jun 20  2005 /lib/libcrypto.so.4 -> libcrypto.so.0.9.7a

Our application would link just fine against libcrypto.so.2 but
because libcrypto.so.4 is present on the system (and needed for
a different application) this application always links against
libcrypto.so.4 .

Unfortunately it goes on an embedded device and the /lib directory
on the embedded device is not upgradeable, even though the apps
are upgradeable.  And of course the embedded device's /lib directory
contains only libcrypto.so.2...

Does anyone know how to force the linker to link the app against
libcrypto.so.2 ?  It's provided by openssl as are the header files
which define the symbols/functions.

Obviously -lcrypto2 doesn't work.  Or does it?  Can we do that?

We could make a /tmp/lib and put the newer libcrypto on there but
it's a huge file and let's just say that downloading it to all of
our devices would be Expensive, especially because of the way we
do software upgrades (large packages, have to re-download the whole
thing every time).

We could make the application statically linked of course.  This
would make it big but maybe not as big as including libcrypto.so.4 ?
We might do this but I'm wondering if there's an easier way.

Thanks,
Jim

-- 
Jim Ockers, P.Eng. (ockers at ockers.net)
Contact info: please see http://www.ockers.net/
_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list