macOS: guard X11/Xlib.h include for non-X11 platforms#3065
Merged
sprunk merged 1 commit intoJun 25, 2026
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Guard the
<X11/Xlib.h>include inrts/System/SpringApp.cppwith#ifndef __APPLE__.The include sat in the
#elseof#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()inInitPlatformLibs(), is already excluded on__APPLE__at the call site: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.