Re: when GCC searches the system include directories, "/usr/include" first, or "usr/lib/gcc/include", "usr/local/lib/gcc/include" first?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Song,

first of all, please always include the gcc-help mailing list in your
replies

> Seems the pipe [echo "" |  gcc ] not been recognized by gcc as a valid
input. Tried [touch tmp.c] then [gcc -xc -c -v tmp.c -o tmp.o], and it
works.

Yep, that's the alternative to do it in two steps


> A curious question, actually 2:
> 1. why search /usr/local/include before /usr/include?
> 2. What is the intention of having a /usr/local in case we already have
/usr to install all "user-specific-packages"?

The /usr/local hierarchie is usually used to install 'local' programs
meaning programs which aren't deployed by the distribution's package
manager. Or said differently, self-compiled programs.

I assume the /usr/local/include has been added to gcc's search paths to
allow system administrators to easily overwrite the default include
headers (available in /usr/include), e.g. for testing/debugging purpose.

Why are you asking? Just for interest, or do you have any problems with
the include search paths?

Andi

>
> Best Regards,
>
> Song Du
>
> Application Processor System Engineering @ Marvell Technology Shanghai Ltd.
>
> -----Original Message-----
> From: Andi Hellmund [mailto:mail@xxxxxxxxxxxxxxxx]
> Sent: 2010Äê5ÔÂ17ÈÕ 20:57
> To: Song Du
> Cc: mail@xxxxxxxxxxxxxxxx
> Subject: RE: when GCC searches the system include directories,
"/usr/include" first, or "usr/lib/gcc/include",
"usr/local/lib/gcc/include" first?
>
> Hey Song,
>
>> For example, the GCC -v option copied from my Ubuntu desktop:
>> Target: i486-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu
>> 4.4.1-4ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
>> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
>
> Right, by using the -v option without any input files, you get only the
> options passed to the configure script. [The --prefix option dictates
> where the finaly executables will be installed to]
>
> Just try:
>
> # echo "" | gcc -c -v -x c - -o tmp.o
>
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/local/include
>  /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/include
>  /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.3/include-fixed
>  /usr/include
>
>
> @ALL: I'll add this type of question to the wiki-FAQ
>
> Best regards,
> Andi




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux