Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to prempt /lib and /usr/lib in /etc/ld.so.conf ?

13 views
Skip to first unread message

szr

unread,
May 12, 2008, 1:13:06 PM5/12/08
to
I'm in the process upgrading things on my Linux system, and for most
things I'm using ./configure --prefix=/usr/local/<name>-<version> and
after it's "make install"'ed I update include and lib search paths
accordingly.

I have noticed this, however, for example:

# ldconfig -v | egrep '^/|libgmp'
/lib:
/usr/lib:
libgmp.so.3 -> libgmp.so.3.3.2
/usr/local/binutils-2.18/lib:
/usr/local/gettext-0.17/lib:
/usr/local/gmp-4.2.2/lib:
libgmp.so.3 -> libgmp.so.3.4.2
/usr/local/mpfr-2.3.1/lib:
/usr/local/mysql5/lib/mysql:
/usr/local/lib:
...

I would like the newer libgmp to be seen first. I do not want to delete
the old one yet (which would work.)

I tried putting /lib and /usr/lib after the line with
/usr/local/mysql5/lib/mysql, but that doesn't work:

# ldconfig -v | egrep '^/'
ldconfig: Path `/lib' given more than once
ldconfig: Path `/usr/lib' given more than once
/lib:
/usr/lib:
...

And they still end up at the top. I've checked the man pages and search
google but haven't been able to find a solution.

Thanks.

--
szr


Dave Uhring

unread,
May 12, 2008, 2:08:05 PM5/12/08
to
On Mon, 12 May 2008 10:13:06 -0700, szr wrote:

> I would like the newer libgmp to be seen first. I do not want to delete
> the old one yet (which would work.)

....


> And they still end up at the top. I've checked the man pages and search
> google but haven't been able to find a solution.

Which man pages? Clearly not the one which matters, ld.so(8).
Look for PRELOAD.

szr

unread,
May 12, 2008, 3:31:08 PM5/12/08
to

Thank you for your reply. I looked at that already, and I don't think
that's what I need.

I simply want to arrange my /etc/ld.so.conf so it will accept entries
before /lib and /usr/bin, which seem to always be implicitly at the
beginning.

--
szr


Dave Uhring

unread,
May 12, 2008, 4:17:20 PM5/12/08
to
On Mon, 12 May 2008 12:31:08 -0700, szr wrote:
> Dave Uhring wrote:

>> Which man pages? Clearly not the one which matters, ld.so(8). Look for
>> PRELOAD.

> I simply want to arrange my /etc/ld.so.conf so it will accept entries


> before /lib and /usr/bin, which seem to always be implicitly at the
> beginning.

The run-time link editor will *always* look to /lib then /usr/lib first
unless you override that with LD_PRELOAD.

Of course, your other option is simply to remove the library which you do
not want loaded.

szr

unread,
May 12, 2008, 5:01:45 PM5/12/08
to

Thanks. LD_PRELOAD is for pre loading shared libs. I just want to add
paths to the search list before /lib and /usr/lib

--
szr


Dave Uhring

unread,
May 12, 2008, 5:12:58 PM5/12/08
to

You mentioned only *one* library. That is what LD_PRELOAD is for.

You can't do it by hacking on /etc/ld.so.conf. Using LD_LIBRARY_PATH or
LD_RUN_PATH may work, but do *not* set that in your user's environment.
Write a shell script to exec your binary.

0 new messages