Has anybody tried to install Wireguard?

I’ve tracked down what I believe to be the source of the problem to the use of the make headers_install command in the kernel-osmc build. There’s a shell script at ./src/linux-4.14.78/scripts/headers_install.sh that contains this piece of code:

echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]"
echo
echo "Prepares kernel header files for use by user space, by removing"
echo "all compiler.h definitions and #includes, removing any"
echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
echo "asm/inline/volatile keywords."
echo
echo "OUTDIR: directory to write each userspace header FILE to."
echo "SRCDIR: source directory where files are picked."
echo "FILES:  list of header files to operate on."

It take the uapi headers and changes code such as:

#ifndef __KERNEL__ 
#include <sys/socket.h>     /* for struct sockaddr. */ 
#endif

to

#include <sys/socket.h>			/* for struct sockaddr.		*/

thereby losing the #ifndef logic. This doesn’t happen on Raspbian – and I don’t understand why this logic is being stripped out. Perhaps @sam_nazarko can explain why it’s done this way.

It looks like the altered files are then copied from ./include/linux/uapi to ./include/linux, which is why you see two different versions of (for example) if.h. It’s not simply a matter of deleting everything from ./include/linux since it wasn’t originally empty.