[svlug] how to modify default directory search order for GCC
tony yu
yutaotao at gmail.com
Mon Aug 7 17:24:15 PDT 2006
i have researched a bit and it seems like that order is pre-built inside GCC
(or actually ld, the linker).
My problem is that I have built a library (say libz.so) under my current
directory, and i want my executable (say, mytest)
to be linked and run against that version.
However, since libz.so already exists on my system (/usr/lib), although it's
an old version, by running following gcc command:
gcc -o mytest mytest.c -L. -lz
and ldd mytest will show
it is linked to /usr/lib/libz.so
and it should be like that, as -L. puts the additional directory AFTER the
default order.
and running mytest will still use /usr/libz.so even I export
LD_LIBRARY_PATH=. as it is already located during linking time.
My question is, and hope, someone has seen it before,
how do I make my exectuable use the one I desired (in current directory)
instead of the one at /usr/lib?
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://kenny.linuxmafia.com/pipermail/svlug/attachments/20060807/2ee603ec/attachment.htm
More information about the Svlug
mailing list