Missing linux-headers
Hi, How to update linux-headers for kernel (6.0.0) compiled from source in centos? System has kernel 4.18 headers while kernel is 6.0, however userspace program generates error e.g* fatal error: linux/mutex.h: No such file or directory* Regards
On 8/10/22 15:01, neutrino network wrote:
How to update linux-headers for kernel (6.0.0) compiled from source in centos?
System has kernel 4.18 headers while kernel is 6.0, however userspace program generates error e.g*fatal error: linux/mutex.h: No such file or directory*
linux/mutex.h is a kernel header. User-space programs don't use those. Are you trying to compile an out-of-tree module by any chance? If so, you should probably install the kernel development headers packaged by your distribution, and point your makefile to those (or you can just point it to the directory where you built your kernel). Hope that helps. Scott.
On Sat, Oct 8, 2022 at 11:21 AM Scott J. Crouch <scottjcrouch@gmail.com> wrote:
On 8/10/22 15:01, neutrino network wrote:
How to update linux-headers for kernel (6.0.0) compiled from source in centos?
System has kernel 4.18 headers while kernel is 6.0, however userspace program generates error e.g*fatal error: linux/mutex.h: No such file or directory*
linux/mutex.h is a kernel header. User-space programs don't use those.
Are you trying to compile an out-of-tree module by any chance? If so, you should probably install the kernel development headers packaged by your distribution, and point your makefile to those (or you can just point it to the directory where you built your kernel).
Hope that helps.
Scott.
linux/mutex.h is a kernel header. User-space programs don't use those. Are you trying to compile an out-of-tree module by any chance? This is a test on a patched kernel. The patch has an API for userspace programs.
If so, you should probably install the kernel development headers packaged by your distribution, Trying to install headers with "sudo yum -y install kernel-headers" returns that headers are already installed even its removal reinstall the old kernel headers Tried also "yum install kernel-headers-$(uname -r) " !
and point your makefile to those (or you can just point it to the directory whereyou built your kernel). How can my application point to the kernel source, does it require settings in glibc?
Tried "make headers_install" in kernel source but still faced the error issue ! btw if a destination directory is passed e.g "make headers_install INSTALL_HDR_PATH=/usr/include", i found that "net" directory is missing in the destination directory it only place some files and not all, am i using it correctly? Note: I don't "make install" after any of above commands Regards
On 9/10/22 17:10, neutrino network wrote:
This is a test on a patched kernel. The patch has an API for userspace programs.
Ok, ignore what I said earlier. Headers necessary for using the user-space API are exported with the *user-space* headers. That's the stuff sitting in <kernel_src>/include/uapi/ (and some other parts).
Trying to install headers with "sudo yum -y install kernel-headers" returns that headers are already installed even its removal reinstall the old kernel headers Triedalso "yum install kernel-headers-$(uname -r)|| " !
These are indeed the user-space headers. However, if your kernel patch is private, then any changes to the user-space headers won't be in there. If you're instead relying on kernel headers from the kernel source (which is not something you would normally do), then you need to tell gcc with something like "-I</path/to/header-files>". (If this is what you're actually trying to do, then ignore what I've said below.)
How can my application point to the kernel source, does it require settings in glibc?
Tried "make headers_install" in kernel source but still faced the error issue ! btw if a destination directory is passed e.g "make headers_install INSTALL_HDR_PATH=/usr/include", i found that "net" directory is missing in the destination directory it only place some files and not all, am i using it correctly?
"make INSTALL_HDR_PATH="/usr/local" headers_install" is probably what you want (note I didn't put "include/" in the path). Depending on how the toolchain is configured, it should be looking for headers in /usr/local/include first, /usr/include/ second (you can see what it's doing with "cpp -v"). Hope that helps, Scott.
On Sun, Oct 9, 2022 at 2:11 AM neutrino network <neutrino.network1@gmail.com> wrote:
...
If so, you should probably install the kernel development headers packaged by your distribution, Trying to install headers with "sudo yum -y install kernel-headers" returns that headers are already installed even its removal reinstall the old kernel headers Tried also "yum install kernel-headers-$(uname -r) " !
Sadly, that {behavior|misfeature|bug} has been around forever: the kernel-headers package does not install kernel headers. Also see https://bugzilla.redhat.com/show_bug.cgi?id=1190394 . You may want the kernel-devel package, instead. Jeff
On Mon, Oct 10, 2022 at 6:41 AM Jeffrey Walton <noloader@gmail.com> wrote:
On Sun, Oct 9, 2022 at 2:11 AM neutrino network <neutrino.network1@gmail.com> wrote:
...
If so, you should probably install the kernel development headers packaged by your distribution, Trying to install headers with "sudo yum -y install kernel-headers" returns that headers are already installed even its removal reinstall the old kernel headers Tried also "yum install kernel-headers-$(uname -r) " !
Sadly, that {behavior|misfeature|bug} has been around forever: the kernel-headers package does not install kernel headers. Also see https://bugzilla.redhat.com/show_bug.cgi?id=1190394 .
You may want the kernel-devel package, instead.
Jeff
Thank you all, I set the environment variable "export C_INCLUDE_PATH=<linux-kernel-source-path>/usr/include/" and the application can now be compiled. Cheers
participants (3)
-
Jeffrey Walton -
neutrino network -
Scott J. Crouch