[clue-tech] Forcing gcc compiler to link against specific so
Jim Ockers
ockers at ockers.net
Thu Jan 5 20:15:56 MST 2006
Hi Marcus,
Thanks!
> On Thu, Jan 05, 2006 at 06:16:39PM -0700, Jim Ockers wrote:
> > 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 .
>
> One way to do this is instead of "-lcrypto", use "/lib/libcrypto.so.2".
> Another way is to create a directory with a symlink
>
> dumylib:
> libcrypto.so -> /lib/libcrypto.so.2
>
> Then, use "-Ldumylib -lcrypto".
Hey, this works perfectly. Now our application is linked against these
libraries:
libsqlplus.so.1 => /usr/lib/libsqlplus.so.1 (0x40033000)
libz.so.1 => /usr/lib/libz.so.1 (0x400a2000)
libcrypto.so.2 => /lib/libcrypto.so.2 (0x400b0000)
libdl.so.2 => /lib/libdl.so.2 (0x40173000)
libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x40177000)
libm.so.6 => /lib/i686/libm.so.6 (0x401b9000)
libc.so.6 => /lib/i686/libc.so.6 (0x401dd000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
As you can see libcrypto.so.4 is nowhere to be found. OutSTANDing!
Thanks again.
I wonder why my google searches didn't turn anything up about this? Hm!
--
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