[svlug] modify default directory search order for GCC

tony yu yutaotao at gmail.com
Tue Aug 8 13:24:26 PDT 2006


nothing else is pulling in /usr/lib/libz.so.
i did a test,

under current directory, i have zlibtest.c, zlib.h and libz.so.

zlibtest.c

#include "zlib.h"
int main()
{
printf("inside zlibtest main\n");
return 0;
}

1. export LD_LIBRARY_PATH=.
2. gcc -o zlibtest zlibtest.c -L. -lz
3. ldd zlibtest
        libz.so.1 => /usr/lib/libz.so.1 (0xb75c8000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb7490000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb75eb000)

i read man ld before, and it does say that LD_LIBRARY_PATH is before /lib
and /usr/lib, however,
if it already has /usr/lib/libz.so from ldd output, it should pick up that
first, am i right?

On 8/8/06, Ken Blake <kblake2 at gmail.com > wrote:
>
> Have you read the man page for ld.so?  At runtime it should look in
> LD_LIBRARY_PATH before checking /lib and /usr/lib.  I would stay
> away from hard coded paths if you expect others to use it.  Are you
> linking in any other shared objects?  Check if they might be pulling
> in /usr/lb/libz.so.
>
> Ken
>
> _______________________________________________
> svlug mailing list
> svlug at lists.svlug.org
> http://lists.svlug.org/lists/listinfo/svlug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://kenny.linuxmafia.com/pipermail/svlug/attachments/20060808/d1bae50a/attachment.htm 


More information about the Svlug mailing list