I am trying to compile module but get this error.
fatal error: sys/types.h: No such file or directory compilation terminated.
Here is my module file headers
#include <linux/init.h> // Macros used to mark up functions e.g. __init __exit #include <linux/module.h> // Core header for loading LKMs into the kernel #include <linux/device.h> // Header to support the kernel Driver Model #include <linux/kernel.h> // Contains types, macros, functions for the kernel #include <linux/fs.h> // Header for the Linux file system support #include <asm/uaccess.h> // Required for the copy to user function #include <sys/types.h>
And my Makefile
obj-m = test.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
I have tried to search for this file
find /usr/include -name types.h
Here are results
/usr/include/sys/types.h /usr/include/libr/sdb/types.h /usr/include/rpc/types.h /usr/include/i386-linux-gnu/sys/types.h /usr/include/i386-linux-gnu/asm/types.h /usr/include/i386-linux-gnu/bits/types.h /usr/include/linux/iio/types.h /usr/include/linux/types.h /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/x86_64-linux-gnu/asm/types.h /usr/include/x86_64-linux-gnu/bits/types.h /usr/include/asm-generic/types.h /usr/include/c++/5/parallel/types.h
I tried to set it as #include "/usr/include/sys/types.h"
but got following error
/usr/include/sys/types.h:25:22: fatal error: features.h: No such file or directory compilation terminated.
I am using Kali Linux(Debian)
AMD64 platform
Linux kali 4.5.0-kali1-amd64 #1 SMP Debian 4.5.5-1kali1 (2016-06-06) x86_64 GNU/Linux
What is wrong ? Thanks
SOLVED
Sorry this was my fault, I made a typo in type and tried to include sys/types.h
file, but it was not required at all all types are declared in /usr/src/linux-headers-4.5.0-kali1-common/include/linux/types.h
in my case. Thanks everyone.
Advertisement
Answer
Sorry this was my fault, I made a typo in type and tried to include sys/types.h file, but it was not required at all all types are declared in /usr/src/linux-headers-4.5.0-kali1-common/include/linux/types.h in my case. Thanks everyone.