bmx-ng / sdl.mod

SDL backend for BlitzMax
7 stars 6 forks source link

Linux: Build issues with SDL 2.28 commit #53

Closed GWRon closed 11 months ago

GWRon commented 1 year ago

When I try to build the current sdl.mod it fails for me:

[ 44%] Compiling:SDL_windowevents.c
/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/core/linux/SDL_evdev.c: In function ‘SDL_EVDEV_init_touchscreen’:
/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/core/linux/SDL_evdev.c:634:38: error: ‘SDL_UDEV_DEVICE_TOUCHPAD’ undeclared (first use in this function)
  634 |                        (udev_class & SDL_UDEV_DEVICE_TOUCHPAD) ? SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE : SDL_TOUCH_DEVICE_DIRECT,
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~
/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/core/linux/SDL_evdev.c:634:38: note: each undeclared identifier is reported only once for each function it appears in
[ 44%] Compiling:imKStoUCS.c
/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/core/linux/SDL_evdev.c: In function ‘SDL_EVDEV_device_added’:
/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/core/linux/SDL_evdev.c:787:5: error: variable-sized object may not be initialized
  787 |     unsigned long relbit[NBITS(REL_MAX)] = { 0 };
      |     ^~~~~~~~
[ 44%] Compiling:SDL_rwops.c
[ 45%] Compiling:SDL_sysfilesystem.c
[ 45%] Compiling:SDL_haptic.c
[ 45%] Compiling:SDL_syshaptic.c
/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/core/linux/SDL_evdev.c:821:23: error: ‘SDL_UDEV_DEVICE_TOUCHSCREEN’ undeclared (first use in this function)
  821 |     if (udev_class & (SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD)) {
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/core/linux/SDL_evdev.c:821:53: error: ‘SDL_UDEV_DEVICE_TOUCHPAD’ undeclared (first use in this function)
  821 |     if (udev_class & (SDL_UDEV_DEVICE_TOUCHSCREEN | SDL_UDEV_DEVICE_TOUCHPAD)) {
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~

The original issue was fixed in 2.25 https://github.com/libsdl-org/SDL/commit/71fb91f7e43c5f046a037bf5ca59214d93fe2d51

Yet a commit some months ago brought it back: https://github.com/libsdl-org/SDL/commit/9f8b68a2785563031473011379878bb63ed5d3a3

Maybe it just misses some config adjustments.

a temporary fix is to edit sdl.mod/sdl.mod/SDL/src/core/linux/SDL_evdev_capabilities.h and change

#if HAVE_LINUX_INPUT_H
...
#endif /* HAVE_LINUX_INPUT_H */

to

//#if HAVE_LINUX_INPUT_H
...
//#endif /* HAVE_LINUX_INPUT_H */
GWRon commented 1 year ago

Needed to comment the same out in the corresponding .c file

And i needed to add this to "sdl.mod/sdl.mod/linux_source.bmx": Import "SDL/src/events/SDL_keysym_to_scancode.c"

woollybah commented 1 year ago

I guess the actual issue is this

    if(LINUX AND HAVE_LINUX_INPUT_H AND NOT ANDROID)
      set(SDL_JOYSTICK_LINUX 1)
      file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
      list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES})
      set(HAVE_SDL_JOYSTICK TRUE)
    endif()

we shouldn't even include the joystick stuff is linux input is not available

GWRon commented 11 months ago

Should be fixed with the commit faff66039645b96c15ff22844053b0949364c3dc