Skip to content

macOS: guard X11/Xlib.h include for non-X11 platforms#3065

Merged
sprunk merged 1 commit into
beyond-all-reason:masterfrom
tomjn:macos/springapp-x11-include-guard
Jun 25, 2026
Merged

macOS: guard X11/Xlib.h include for non-X11 platforms#3065
sprunk merged 1 commit into
beyond-all-reason:masterfrom
tomjn:macos/springapp-x11-include-guard

Conversation

@tomjn

@tomjn tomjn commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What

Guard the <X11/Xlib.h> include in rts/System/SpringApp.cpp with #ifndef __APPLE__.

The include sat in the #else of #ifdef _WIN32, so every non-Windows platform pulled it in. macOS has no X11 headers by default, which breaks the native build at this include.

Its only consumer, XInitThreads() in InitPlatformLibs(), is already excluded on __APPLE__ at the call site:

#if !(defined(_WIN32) || defined(__APPLE__) || defined(HEADLESS)) || defined(__OpenBSD__)
    if (!XInitThreads()) { ... }
#endif

so guarding the include the same way leaves no dangling reference.

Safety

Additive guard. Linux/Windows/BSD builds are unaffected (they still get the include and the call). macOS stops including a header it doesn't have.

Verified by inspection; macOS isn't in CI yet. Part of the "big mac" bring-up; extracted while reviewing #3060.

SpringApp.cpp included <X11/Xlib.h> for every non-Windows platform, but
macOS has no X11 headers by default, breaking the native build. The only
user of it, XInitThreads(), is already excluded on __APPLE__ at its call
site, so guard the include the same way.
@tomjn tomjn marked this pull request as ready for review June 25, 2026 15:05
@sprunk sprunk merged commit a854046 into beyond-all-reason:master Jun 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants