Make sure the searching header file path when building Linux kernel

Akash Bhatnagar actiononmail at gmail.com
Wed Aug 5 06:25:01 EDT 2015


Hi,

As per GCC Documentation (
https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html) if you do not instruct
GCC otherwise,
it will look for headers requested with #include <file> in:

     /usr/local/include
     libdir/gcc/target/version/include
     /usr/target/include
     /usr/include

You can very well prioritize header file lookup to your path via -I<path of
header> flag during compilation.
Another option is to provide --sysroot=<path to sysroot> in order to lookup
system headers in your own
sysroot.

Command cpp -v will show you the look up process of header file.

Thanks
Akash Bhatnagar


On Wed, Aug 5, 2015 at 3:13 PM, Nan Xiao <xiaonan830818 at gmail.com> wrote:

> Hi all,
>
> I want to make sure the searching header file path when building Linux
> kernel:
> Per my understanding, the gcc only find header files in current building
> linux
> directory: include/*, won't search system header file path: such as
> /usr/inclue,
>  /usr/local/include, etc.
>
> Is my understanding right? Thanks very much in advance!
>
> Best Regards
> Nan Xiao
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150805/cabe5cf6/attachment.html 


More information about the Kernelnewbies mailing list