On Tue, Jun 28, 2011 at 02:05:05AM +0200, Vincent Lefevre wrote:
> > >   http://gcc.gnu.org/ml/gcc-help/2010-11/msg00341.html

> > This particular issue will not occur with multiarch, because /usr/lib/<arch>
> > will never be a symlink to /usr/lib in the canonical implementation.

> There will be the same issue if libraries are installed directly
> in /usr/lib/<arch> (see below).

No, it's not the *same* issue.  The issue you referenced is /usr/lib taking
precedence over /usr/local/lib because of /usr/lib64 being a symlink.  In
multiarch, /usr/local/lib still takes precedence over /usr/lib. 
*/usr/lib/$arch* might take precedence over /usr/local/lib, and that's not
desirable, but it's not the same issue.

> > As a practical matter, the runtime path will list all of the multiarch paths
> > before all of the non-multiarch paths.

> Like what upstream GCC does. So, this means that if I have LIBRARY_PATH
> (and LD_LIBRARY_PATH) containing $HOME/lib, the library search path
> would be something like:

>   $HOME/lib/<arch>
>   /usr/local/lib/<arch>
>   /lib/<arch>
>   /usr/lib/<arch>
>   $HOME/lib
>   /usr/local/lib
>   /lib
>   /usr/lib


Huh?  Certainly not.  Why would you expect gcc to look in $HOME/lib/<arch>
if you haven't put $HOME/lib/<arch> in your LIBRARY_PATH?  gcc isn't going
to magically append the architecture to all directories in the search path.

with LIBRARY_PATH=$HOME/lib, the build-time order would (currently) be:

   $HOME/lib
   /usr/x86_64-linux-gnu/lib
   /usr/lib/x86_64-linux-gnu
   /lib
   /usr/lib

(via:
 gcc -print-search-dirs | sed -n -e's/^libraries: =//p' | sed -e's/:/\n/g' |
 xargs -n1 readlink -f)

So at build time, there doesn't appear to be an issue.

> > (It does this already today.)

> No, it doesn't. Well, it may depend on the tool, but for instance,
> with the dynamic linker, the search order is:

>   prefix1/lib/<arch>
>   prefix1/lib
>   prefix2/lib/<arch>
>   prefix2/lib
>   prefix3/lib/<arch>
>   prefix3/lib

> instead of:

>   prefix1/lib/<arch>
>   prefix2/lib/<arch>
>   prefix3/lib/<arch>
>   prefix1/lib
>   prefix2/lib
>   prefix3/lib

> (according to strace). I think this is the right solution to avoid
> the problem mentioned above.

Ok - I didn't think we had this right, but it's great to know that we do.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org

Attachment: signature.asc
Description: Digital signature

Reply via email to