Question

when i try to install kernel header in ubuntu it is installed in /usr/src/linux-header-2.6.x-y

many place in the web (including below) says it should be installed in /usr/include/linux/*

http://www.mjmwired.net/kernel/Documentation/make/headers_install.txt

why there is a discrepancy in the ubuntu kernel header install?

also if i want to use these header do i need to use -I switch in gcc?

Some of the reference also state that files under /usr/include/linux should contain symlink to /usr/src/linux-header-2.6.x-y which does not seems to be the case here...

Was it helpful?

Solution

The headers in /usr/include/linux are the headers of the kernel which glibc and other system libraries depend on. See to which package they belong:

$ dpkg -S /usr/include/linux/if.h 
linux-libc-dev: /usr/include/linux/if.h

Some of glibc sys/ headers depend on the linux/ headers, and these are usually the same headers (or close to the ones) glibc's binary was compiled against.

Therefore, building a custom kernel should not replace those by default, otherwise it can create binary incompatibility.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top