gcc --print-search-dirs

Dan Nicholson dbn.lists at gmail.com
Tue Jan 16 17:59:45 PST 2007

On 1/16/07, Paul Novak <pdnovak at comcast.net> wrote:
> I'm working a LFS build using the SVN-20061209 book.   Going along
> OK until I got into BLFS, getting X and my chosen window manager
> to build.  As I built up all the dependencies, I started to
> get warnings from 'libtool' saying it looked like a library had moved.
> I tracked it down to this:
> If I run
>     gcc --print-search-dirs | grep libraries
> I get this output:
> libraries: =/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/:/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/:/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../i686-pc-linux-gnu/lib/i686-pc-linux-gnu/4.1.1/:/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../i686-pc-linux-gnu/lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../i686-pc-linux-gnu/4.1.1/:/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../:/lib/i686-pc-linux-gnu/4.1.1/:/lib/:/usr/lib/i686-pc-linux-gnu/4.1.1/:/usr/lib/
> Note that if the following directory exists (which is does):
>     /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../..
> then it's the same as:
>     /usr/lib.
> What's happening when libtool runs is that it compares the first directory in the
> search path  (the long name) with /usr/lib, they are not exactly the same
> (even though the evaluate to the same directory), and a warning results.

You got it. It's just a warning and nothing to worry about. Just
libtool suckiness. The thing is, I'd imagine this is fixed in newer
versions of libtool. However, libtool works like autoconf in that you
distribute a version with your project. If some package you're
building has been distributed with an older version of libtool, it
probably has this issue.

You could work around this by always running libtoolize or autoreconf
or something to rebuild the autotools with the recent ones on your
system, but it's not worth it, IMO. And it might break packages that
have autotools commands that won't work with newer versions. And maybe
that issue isn't fixed in newer libtool.

As for duplicate or redundant paths in `gcc -print-search-dirs', feel
free to wade into gcc and fix it :) But there's years of logic put
into how that path spec is put together. It's not an issue to have
duplicate paths there, or we'd all have broken systems.


More information about the lfs-support mailing list