question about -print-search-dirs

Kate Minola kate01123@gmail.com
Mon Sep 11 18:36:00 GMT 2006


Perhaps a kind person would explain what -print-search-dirs is printing.
The manual entry is not very enlightening.

When I do

%gcc -print search-dirs

I get output of which the "libraries=" line lists the following libraries

libraries: =/usr/local/gcc-4.1.1/x86_64-Linux/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/
:/usr/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/
:/usr/local/gcc-4.1.1/x86_64-Linux/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../x86_64-unknown-linux-gnu/lib/x86_64-unknown-linux-gnu/4.1.1/
:/usr/local/gcc-4.1.1/x86_64-Linux/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../x86_64-unknown-linux-gnu/lib/
:/usr/local/gcc-4.1.1/x86_64-Linux/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../x86_64-unknown-linux-gnu/4.1.1/
:/usr/local/gcc-4.1.1/x86_64-Linux/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../
:/lib/x86_64-unknown-linux-gnu/4.1.1/
:/lib/
:/usr/lib/x86_64-unknown-linux-gnu/4.1.1/
:/usr/lib/

Yet if I do

% gcc -v -o hello hello.c

for a simple "hello world" program, then the libraries listed
(following "-L") are

-L/usr/local/gcc-4.1.1/x86_64-Linux/lib/gcc/x86_64-unknown-linux-gnu/4.1.1
-L/usr/local/gcc-4.1.1/x86_64-Linux/lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../lib64
-L/lib/../lib64
-L/usr/lib/../lib64

I guess I would have expected that the two lists of libraries would be the same,
or perhaps that the second list would be contained in the first.  But
this does not
seem to be the case.

What am I missing?

Kate Minola
University of Maryland, College Park



More information about the Gcc mailing list