Fix macOS build failure with GCC 15#2095
Open
DrishtiTripathi2230 wants to merge 5 commits into
Open
Conversation
Defining _XOPEN_SOURCE on Darwin lowers __DARWIN_C_LEVEL, hiding quick_exit/at_quick_exit. GCC 15's libstdc++ <cstdlib> unconditionally does 'using ::quick_exit;', which fails to compile when those symbols are hidden. Defining _DARWIN_C_SOURCE alongside _XOPEN_SOURCE restores full Darwin visibility while keeping the POSIX/SUSv2 definitions cctz needs elsewhere. Scoped to __APPLE__ only; no effect on other platforms. Fixes abseil#2027
…EN_SOURCE" This reverts commit c7f471f.
…PEN_SOURCE" This reverts commit 5b123e1.
Contributor
|
This code is forked from https://github.com/google/cctz, can you please open a PR there? |
Contributor
|
This also seems like maybe the fix to google/cctz#265 was just too wide? Could we just add Apple to the exclusion list? The original issue was to fix a problem in QNX |
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.
Fixes #2027
Problem
Building Abseil on macOS with Homebrew GCC 15 fails with:
error: 'quick_exit' has not been declared in '::'error: 'at_quick_exit' has not been declared in '::'Root cause
_XOPEN_SOURCE 500, defined intime_zone_format.ccto expose SUSv2/POSIXdefinitions, lowers
__DARWIN_C_LEVELon Darwin, hiding C11 additions likequick_exit/at_quick_exit. GCC 15's libstdc++<cstdlib>now unconditionallyre-exports these into the global namespace, which fails when the underlying
declarations are hidden.
Fix
Define
_DARWIN_C_SOURCEalongside_XOPEN_SOURCE, scoped to__APPLE__only,restoring both POSIX and C11 visibility on Darwin without affecting other
platforms (Linux/FreeBSD/OpenBSD behavior unchanged).
Testing
Verified with a CI workflow on a macos-latest runner + Homebrew GCC 15: