SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Android build fails when HIDAPI is disabled

Open kambala-decapitator opened this issue 6 months ago • 1 comments

the error is:

ld: error: undefined symbol: HIDDeviceManager_tab
>>> referenced by SDL_android.c:541 (/Users/kambala/.conan2/p/b/sdl88a638364257e/b/src/src/core/android/SDL_android.c:541)
>>>               CMakeFiles/SDL3-shared.dir/src/core/android/SDL_android.c.o:(JNI_OnLoad)

JNI_OnLoad references HIDDeviceManager_tab unconditionally:

https://github.com/libsdl-org/SDL/blob/71f479b4aaf75f8d3c5eaf09da158c71233c7005/src/core/android/SDL_android.c#L564-L564

but hid.cpp (where the definition of HIDDeviceManager_tab lives) is compiled only when HIDAPI is enabled:

https://github.com/libsdl-org/SDL/blob/71f479b4aaf75f8d3c5eaf09da158c71233c7005/cmake/sdlchecks.cmake#L1142-L1146

kambala-decapitator avatar Jun 12 '25 16:06 kambala-decapitator

Since the Java code references those functions, I think we need to always include android/hid.cpp, and the HIDAPI guard should affect functionality instead. I haven't taken a closer look yet, but feel free to create a PR for this issue.

slouken avatar Jun 12 '25 16:06 slouken

@madebr, can you take a look at this?

slouken avatar Jun 26 '25 19:06 slouken