Fails to build on ghostBSD

Ahoy,

I’m trying to build the git repo version of SDL on ghostBSD. I’ve tried using GCC 11, but I get this error:

[ 87%] Building C object CMakeFiles/SDL2-static.dir/src/core/linux/SDL_udev.c.o
/usr/home/mm/Desktop/SDL_port/lib/SDL/src/core/linux/SDL_udev.c:32:10: fatal error: linux/input.h: No such file or directory
   32 | #include <linux/input.h>
      |          ^~~~~~~~~~~~~~~

Any ideas what is going on?

Post uname -a from the command line.

FreeBSD mm-ghostbsd-pc 13.0-STABLE FreeBSD 13.0-STABLE GENERIC

linux/input.h: No such file or directory, it tries to find linux/input.h in the include directories and couldn’t find it.

This is because SDL/src/core/linux/SDL_udev.c is being told to be compiled (unsuccessfully) by cmake.

Since you’re using ghostbsd it shouldn’t try to compile a linux specific file (it should compile the freebsd file since ghostbsd is based of freebsd), so we’ll have to figure out why it cmake included it.

it’s included because HAVE_LIBUDEV_H is set to true. (A quick fix might be to comment this part out).

HAVE_LIBUDEV_H is set to true because it checked for libudev.h in the
include paths and found it.

Is there libudev.h in your include paths?
libudev-devd seems to install libudev.h into the include path but doesn’t directly provide linux/input.h (it’s provided by its build dependency evdev-proto).

Though I don’t think SDL needs udev in freebsd / ghostbsd.

You could try:

  1. Commenting out this part in CMakeLists
  2. Compile using make not cmake. Since it seems that cmake is still experimental
  3. Installing evdev-proto or removing libudev-devd (I don’t think this is the best choice but you might want to try this as a last resort).

Edit: it seems like sdl2 requires evdev-proto so Installing it is probably what you want to do.

Thanks very much for the detailed reply!

Is there libudev.h in your include paths?

Yeah, libudev.h shows up in my /usr/include folder

Edit: it seems like sdl2 requires evdev-proto so Installing it is probably what you want to do.

Awesome, that solved it! Many thanks for the help!