This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: How to set a system-wide library path policy?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: Binutils <binutils at sourceware dot org>, libc-help <libc-help at sourceware dot org>
- Date: Sun, 9 Jun 2019 17:34:16 -0400
- Subject: Re: How to set a system-wide library path policy?
- References: <CAH8yC8mpfEFmu8G3XHfuG=6mMHJt6-QOFaD6b2ONkZWyZJ00dA@mail.gmail.com> <d81a96d4-7896-bab7-1396-5c39a7be881a@redhat.com>
- Reply-to: noloader at gmail dot com
On Fri, Jun 7, 2019 at 4:46 PM Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 6/7/19 10:53 AM, Jeffrey Walton wrote:
> > I'm having trouble figuring out how to setup library path policy on Fedora 29.
>
> The system loader is in glibc. Adding libc-help to the CC.
>
> > I need to articulate to the system loader:
> >
> > 1. programs in /bin must only link to libs in /lib64
> > 2. programs in /usr/bin must only link to libs in /usr/lib64
> > 3. programs in /usr/local/bin may use libraries in /usr/local/lib64 or
> > /usr/lib64
>
> OK.
>
> > As far as I know, the distro supplies (1) and (2). They know nothing
> > about my libraries in /usr/local. When the distro is ready, it will
> > push updated programs and libraries as needed. The distro binaries
> > should not use my libraries.
>
> Why would your distro binaries use your libraries? Such libraries are
> not present at static link time when they are built in the Feodra builders.
>
> The only reason your distro libraries would be used is if you used
> LD_LIBRARY_PATH that pointed to them, in which case you would be altering
> the global search order.
Thanks Carlos,
Here is a Solaris example because I'm updating Git for the 2.20.0
release. Linux behaves the same way as Solaris, so there' no material
difference here.
I'm also cutting over to 64-bit default per Sun's recommendation at
https://docs.oracle.com/cd/E37838_01/html/E66175/features-1.html.
$ command -v git
/usr/bin/git
$ git checkout master -f && git pull
ld.so.1: git: fatal: /usr/local/lib/libpcre2-8.so.0: wrong ELF class: ELFCLASS64
Killed
Sun does not follow their own recommendation and provides a 32-bit
Git. Then, the distros binaries are using the libraries I am building.
As for your question about why this happens... who knows. Some genius
thought it was a good idea to link to the wrong library...
Personally, I don't get the use case: compile and link against one
version of a library at compile time, then runtime link against the
wrong library. Apparently someone asserted that was the number one use
case, and represented it as such out of the box (q.v.).
Jeff