yrutschle / sslh

Applicative Protocol Multiplexer (e.g. share SSH and HTTPS on the same port)
https://www.rutschle.net/tech/sslh/README.html
GNU General Public License v2.0
4.58k stars 366 forks source link

Build fails when landlock.h is not available #417

Closed shadowlmd closed 10 months ago

shadowlmd commented 11 months ago

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
yrutschle commented 11 months ago

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:

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...

shadowlmd commented 11 months ago

I see. I guess I'll have to add some workarounds to my build script. Let's close this one. Thank you.

yrutschle commented 11 months ago

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...

yrutschle commented 10 months ago

@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 :-)

shadowlmd commented 10 months ago

Thank you! It works perfectly. :)