I am trying to compile a device driver to control some LEDs connected via GPIO pins. First, I got errors that
/lib/modules/4.14.31-v7+/build was not found, so I ran
sudo apt-get install raspberrypi-kernel-headersmade a symlink from
/lib/modules/4.14.30-v7+/build/ to the folder it was searching.
I have the following includes:
#include <linux/init.h> #include <linux/module.h> #include <linux/device.h> #include <linux/kernel.h> #include <linux/fs.h> #include <asm/uaccess.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <ctype.h> #include <string.h>
Basically nothing from
sys/stat.h to the end is found by compiler. I found
/usr/include/arm-linux-gnueabihf/sys/ and made a symlink to
/usr/include/sys, which did not help. Instead, I tried
#include </usr/include/arm-linux-gnueabihf/sys/stat.h> #inclue </usr/include/arm-linux-gnueabihf/sys/types.h>
which then caused the compiler to throw an error
/usr/include/arm-linux-gnueabihf/sys/stat.h:25:22: fatal error: features.h: No such file or directory #include <features.h>
I tried commenting out the
sys/*.h files and then had the compiler throw an error for
fcntl.h, and kept going and pretty much every other header was not being found.
FWIW I also tried rpi-update and rebooted. I have no idea what to do.