gcc --print-search-dirs

Paul Novak pdnovak at comcast.net
Tue Jan 16 17:33:07 PST 2007

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):


then it's the same as:

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.

Also note the /usr/lib/gcc/i686-pc-linux-gnu/4.1.1 is listed twice at the beginning
of the search path.


    What is "gcc --print-search-dirs | grep libraries" supposed to return?

    How does gcc figure out the library search path?  
    What if anything can I do to remove the duplicate and reduntant 
    directories in the library search path?

pdnovak at comcast.net

More information about the lfs-support mailing list