Skip to content

Fix SDL threading on macOS/Linux. #107963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025
Merged

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Jun 25, 2025

These files are used only on Windows and seems to cause infinite loop on macOS.

Bugsquad edit:

@@ -90,9 +90,6 @@ if env["builtin_sdl"]:
"stdlib/SDL_string.c",
"stdlib/SDL_strtokr.c",
"thread/SDL_thread.c",
"thread/generic/SDL_syscond.c",
"thread/generic/SDL_sysrwlock.c",
"thread/generic/SDL_systhread.c",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was likely the main issue, it seems like I saw it included in the Windows driver:

thirdparty/sdl/thread/windows/SDL_systhread.c
29:#include "SDL_systhread_c.h"

But I failed to realize this is thread/windows/SDL_systhread_c.h and not thread/generic/SDL_systhread.c.

It's super confusing that they have files with the same names in different folders (so they seem mutually exclusive) but then the Windows one depends on a couple thread/generic files anyway...

@akien-mga
Copy link
Member

I also fixed the SDL update script to take this into account and document it better, and add the pkgconfig Linux fixup for #106218 (comment).

@akien-mga
Copy link
Member

lol what a mess:

Error: thirdparty/sdl/thread/pthread/../generic/SDL_syssem.c:25:10: fatal error: 'SDL_systhread_c.h' file not found
#include "SDL_systhread_c.h"
scons: building terminated because of errors.
         ^~~~~~~~~~~~~~~~~~~

So we shouldn't build thread/generic/SDL_systhread.c as that breaks everything, but thread/generic/SDL_systhread_c.h is needed for thread/generic/SDL_syssem.c which is included automatically for macOS.

And same issue for the Windows part:

Error: thirdparty\sdl\thread\generic\SDL_sysrwlock.c(25): fatal error C1083: Cannot open include file: 'SDL_systhread_c.h': No such file or directory
scons: *** [thirdparty\sdl\thread\generic\SDL_sysrwlock.windows.editor.x86_64.obj] Error 2

So I guess I'll add back the header but without the corresponding C file to avoid the risk of compiling it... this could definitely be improved somewhat upstream to be more self-contained.

And fixup pkg-config check for SDL on Linux.

Co-authored-by: Rémi Verschelde <[email protected]>
@akien-mga akien-mga marked this pull request as ready for review June 25, 2025 09:07
@akien-mga akien-mga requested a review from a team as a code owner June 25, 2025 09:07
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work fine on Linux, tested with an Xbox Series controller on bluetooth.

@akien-mga akien-mga merged commit b720cbc into godotengine:master Jun 25, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants