desmume icon indicating copy to clipboard operation
desmume copied to clipboard

SDL 2.0.14+ API compatibility - Breaks builds with older SDL2 versions

Open Konstantysz opened this issue 1 month ago • 1 comments

State your operating system:

Linux. Affects any build environment with SDL2 < 2.0.14 (e.g., manylinux_2_28 with AlmaLinux 8).

DesMuME version

git master (commit efd74863)

Issue

The code in desmume/src/frontend/posix/shared/ctrlssdl.cpp uses SDL2 touchpad and sensor APIs introduced in SDL 2.0.14, which causes compilation failures on systems with older SDL2 versions.

The problematic APIs are:

  • SDL_GameControllerGetNumTouchpads() (lines 144, 717)
  • SDL_GameControllerHasSensor() (lines 145-146, 718-719)
  • SDL_CONTROLLERTOUCHPAD* event types and event->ctouchpad member (lines 525-562)

For example, manylinux_2_28 (AlmaLinux 8) provides SDL2-devel 2.0.10, which doesn't have these APIs.

Build errors:

../../posix/shared/ctrlssdl.cpp:144:38: error: 'SDL_GameControllerGetNumTouchpads' was not declared in this scope
../../posix/shared/ctrlssdl.cpp:145:27: error: 'SDL_GameControllerHasSensor' was not declared in this scope
../../posix/shared/ctrlssdl.cpp:525:10: error: 'SDL_CONTROLLERTOUCHPADDOWN' was not declared in this scope

Evidence: https://github.com/SkyTemple/py-desmume/actions/runs/18940990364

Suggested fix: Add #if SDL_VERSION_ATLEAST(2, 0, 14) guards around touchpad-related code for backward compatibility. Since these features are informational/debugging only, graceful degradation is acceptable.

Workaround: Build SDL2 2.0.14+ from source in the build environment.

Konstantysz avatar Nov 28 '25 14:11 Konstantysz

I understand the value of backwards compat, however in the case of SDL2 the version alma linux uses is over 5 years old and full of bugs - an imo unusable version. this is a case were it would make much more sense if that distro updates their package, especially considering that newer SDL2 versions can be dropped in without any new dependency or build system requirements. It's literally a case of only updating the upstream tarball information in the build recipe.

rofl0r avatar Nov 29 '25 12:11 rofl0r