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

This is a discussion on how to prempt /lib and /usr/lib in /etc/ld.so.conf ? within the Linux General forums, part of the Linux Forums category; I'm in the process upgrading things on my Linux system, and for most things I'm using ./configure --prefix=/...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-12-2008
szr
 
Posts: n/a
Default how to prempt /lib and /usr/lib in /etc/ld.so.conf ?

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


Reply With Quote
  #2 (permalink)  
Old 05-12-2008
Dave Uhring
 
Posts: n/a
Default Re: how to prempt /lib and /usr/lib in /etc/ld.so.conf ?

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.
Reply With Quote
  #3 (permalink)  
Old 05-12-2008
szr
 
Posts: n/a
Default Re: how to prempt /lib and /usr/lib in /etc/ld.so.conf ?

Dave Uhring wrote:
> 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.


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


Reply With Quote
  #4 (permalink)  
Old 05-12-2008
Dave Uhring
 
Posts: n/a
Default Re: how to prempt /lib and /usr/lib in /etc/ld.so.conf ?

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.
Reply With Quote
  #5 (permalink)  
Old 05-12-2008
szr
 
Posts: n/a
Default Re: how to prempt /lib and /usr/lib in /etc/ld.so.conf ?

Dave Uhring wrote:
> 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.


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


Reply With Quote
  #6 (permalink)  
Old 05-12-2008
Dave Uhring
 
Posts: n/a
Default Re: how to prempt /lib and /usr/lib in /etc/ld.so.conf ?

On Mon, 12 May 2008 14:01:45 -0700, szr wrote:
> Dave Uhring wrote:
>> On Mon, 12 May 2008 12:31:08 -0700, szr wrote:


>>> 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.

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


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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:33 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0