Skip to content

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

@Konstantysz

Description

@Konstantysz

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 efd7486)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions