linux/module.h No such file or Directory
You're missing the Linux kernel headers which allow you to compile code against the Linux kernel.
To install just the headers in Ubuntu:
$ sudo apt-get install linux-headers-$(uname -r)
To install the entire Linux kernel source in Ubuntu:
$ sudo apt-get install linux-source
Note that you should use the kernel headers that match the kernel you are running.
Error compiling kernel module linux/module.h: No such file or directory found
Ok I figured it out, and now I feel so silly...
I was running $ make
but I was getting an error
make: Nothing to be done for `all'.
I took this to mean that I wasn't calling make properly so I started calling $ make hello
to "attempt to make the module" This is where the confusion began as trying to make the file like this was not running the correct make file on my system.
Instead, the real solution was to edit the Makefile to take out the spaces before the build calls and replace them with tabs. This completely fixed my issue and I was able to build without a hitch.
error compiling: linux/module.h: No such file or directory
First thing you need the kernel sources. Many confuse user space headers and kernel space headers because many of them have the same folder structure. Most of the distros only have the user space headers and not the kernel space ones.
And generally make
is used to build a kernel module and not a bare cc
. Follow the simple step-by-step explained Hello World
kernel module given here
linux/kernel.h : No such file or directory
Do you have /usr/src/linux symbolic link to your /usr/src/linux-headers-2.6.35-28-generic ?
If not then create one using following commands
# cd /usr/src
# ln -sfn linux-headers-2.6.35-28-generic linux
Related Topics
How to Tell If Running in a Linux Console Versus an Ssh Session
Looping Through Lines in a File in Bash, Without Using Stdin
Configure Options for Building Mingw-64 on Linux-64 for Linux-64 (Ultimately Targetting Windows-64)
Difference Between --Cap-Add=Net_Admin and Add Capabilities in .Yml
Bash Alias Create File with Current Timestamp in Filename
Rsync --Exclude Not Excluding Specific Files
Extract Text Between Two Strings Repeatedly Using Sed or Awk
How to Manage Log Verbosity Inside a Shell Script
How to Install Valgrind Properly
How to Schedule an R Script Cronjob in a Linux Server
How to Redirect the Telnet Console Logs to a File Linux
Bash: No Such File or Directory
Libpcap - Capture Packets from All Interfaces
Sending Keycode to Xorg + Wine with Bash Script
How to Append to an Indirect Parameter Expansion of an Array in Bash