Skip to content

Commit 63655f7

Browse files
committed
fix(compat.sdl3): the C++ sources a *.c glob cannot see, and GL/glx.h
Two failures from the first CI run, both from assuming a shape rather than checking it. WINDOWS: SDL3 IS NOT ALL C. `core/windows`, `video/windows` and the GameInput joystick backend (`joystick/gdk/SDL_gameinputjoystick.cpp`) carry C++ sources, and `*/src/.../*.c` drops them silently — a glob that misses a file produces no diagnostic at all until the link: lld-link: error: undefined symbol: WIN_InitGameInput lld-link: error: undefined symbol: SDL_GAMEINPUT_JoystickDriver `render/direct3d12` has the same problem in the COMMON list: three of its files are .cpp, so the `*.c` glob was linking half a renderer. Rather than patch only the symbols the linker happened to name, the whole class was found by asking the tree which sources are not .c — 34 directories, of which the windows- relevant ones are these four. macOS was already right because its backends are .m and the globs say .m. LINUX/LLVM: `SDL_x11opengl.h` includes <GL/glx.h>, which is not in the Khronos registry and needs `compat.glx-headers` — the same dependency, for the same reason, that compat.sdl2 carries. This one is worth the comment it now has, because it is invisible from two of the three places you would look: the gcc toolchain's sysroot already carries GL/glx.h, so linux/gcc passed and so did a local build with either compiler. Only the llvm leg says: fatal error: 'GL/glx.h' file not found Verified after the fix that the header now resolves to the PACKAGE's copy (.mcpp/.../compat-x-glx-headers/1.7.0/libglvnd-1.7.0/include/GL/glx.h) rather than to whatever the toolchain happened to have, which is the difference between a fix and a coincidence. Both linux legs pass; windows is CI's to confirm.
1 parent d05bd9c commit 63655f7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎pkgs/c/compat.sdl3.lua‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,9 @@ typedef unsigned int uintptr_t;
840840
"*/src/render/direct3d/*.c",
841841
"*/src/render/direct3d11/*.c",
842842
"*/src/render/direct3d12/*.c",
843+
-- D3D12's renderer is partly C++ (3 files). The `*.c` glob alone
844+
-- links half a renderer on windows.
845+
"*/src/render/direct3d12/*.cpp",
843846
"*/src/render/gpu/*.c",
844847
"*/src/render/ngage/*.c",
845848
"*/src/render/opengl/*.c",
@@ -909,6 +912,16 @@ typedef unsigned int uintptr_t;
909912
-- message-box toolkit, so this is a compile-time header
910913
-- dependency like the X11 set above.
911914
["compat.fribidi"] = "1.0.16",
915+
-- ⚠️ glx-headers, NOT compat.opengl: SDL_x11opengl.h includes
916+
-- <GL/glx.h>, which the Khronos registry does not carry. The
917+
-- two packages overlap on GL/gl.h, so exactly one belongs here
918+
-- — the same call compat.sdl2 makes.
919+
--
920+
-- Easy to miss, because the gcc leg does not need it: that
921+
-- toolchain's sysroot already carries GL/glx.h, so linux/gcc
922+
-- and a local build both pass while linux/llvm fails with
923+
-- "fatal error: 'GL/glx.h' file not found".
924+
["compat.glx-headers"] = "1.7.0",
912925
},
913926
ldflags = { "-ldl", "-lpthread", "-lm", "-lrt" },
914927
},

0 commit comments

Comments
 (0)