Build fails when landlock.h is not available
shadowlmd opened this issue · comments
Tried to build latest SSLH sources on Ubuntu 20.04 and got the following error:
cc -Wall -O2 -DLIBPCRE -g -DENABLE_REGEX -DLIBCONFIG -DLANDLOCK -c -o landlock.o landlock.c
landlock.c:26:10: fatal error: linux/landlock.h: No such file or directory
26 | #include <linux/landlock.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: landlock.o] Error 1
I can see that the header file in question is installed in my system, so it must be something wrong with the Makefile.
$ find /usr/src/ -name landlock.h
/usr/src/linux-hwe-5.15-headers-5.15.0-91/include/uapi/linux/landlock.h
/usr/src/linux-hwe-5.15-headers-5.15.0-89/include/uapi/linux/landlock.h
I would expect landlock.h
to be in /usr/include
instead, and I see in Ubuntu 22.10 that's where it is... so it looks like in 20.04 the kernel supports landlock (it's in the kernel sources) but the distribution hasn't yet moved the header file to the main /usr/include
.
Two solutions:
- disable landlock support in sslh (remove the
1
in the configuration block at the top of the Makefile) - copy landlock.h to
/usr/include
, which I expect should work.
I guess other distributions may have similar problems... I'd rather not get into a whole autoconf
to generate the Makefile, but I'm afraid I'm going to have to, at some point...
I see. I guess I'll have to add some workarounds to my build script. Let's close this one. Thank you.
I'll reopen and rename -- there are probably many systems without landlock out there, and it'd be better if it both used it when available, and compile silently without it if it's not...
@shadowlmd I added a basic autoconf
script so if you configure && make
, it should see that landlock.h is not there and build without it.
I'm an absolute beginner with this, so don't hesitate to re-open if this does not work as intented :-)
Thank you! It works perfectly. :)