Fix build failure with glibc 2.43 due to C11 threads.h conflicts#2262
Open
cary-ilm wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
Open
Fix build failure with glibc 2.43 due to C11 threads.h conflicts#2262cary-ilm wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
cary-ilm wants to merge 3 commits intoAcademySoftwareFoundation:mainfrom
Conversation
Fix conflicting once_flag, ONCE_FLAG_INIT, and call_once definitions when building with glibc 2.43, which now includes C11 <threads.h> support Detect <threads.h> availability and use standard C11 thread primitives when present, falling back to pthread or Windows implementations otherwise CI This also adds a new Linux build (AcademySoftwareFoundation#12) using a Fedora Rawhide container to test against glibc 2.43 Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
meshula
reviewed
Feb 23, 2026
Contributor
meshula
left a comment
There was a problem hiding this comment.
i think the check could be simplified.
|
|
||
| // Check for C11 threads.h availability. | ||
| // Exclude MSVC - its threads.h has compatibility issues with C++ compilation. | ||
| # if !defined(_MSC_VER) && !defined(_WIN32) |
Contributor
There was a problem hiding this comment.
is this check for has include necessary at all? Elsewhere we rely on the version macros, which have been reliable as of, IIRC VS >= 2019, and the old versions of msvc don't support c threads at all.
| # endif | ||
| # endif | ||
| // Also check via __STDC_NO_THREADS__ (defined when threads.h is NOT available) | ||
| # if !defined(EXR_HAS_C11_THREADS) && defined(__STDC_VERSION__) && \ |
Contributor
There was a problem hiding this comment.
I argue that this check within the MSVC block is sufficient all by itself.
Signed-off-by: Cary Phillips <cary@ilm.com>
Member
Author
|
Indeed, I simplified it significantly, it's actually quite simple after all. |
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.
Fix conflicting once_flag, ONCE_FLAG_INIT, and call_once definitions when building with glibc 2.43, which now includes C11 <threads.h> support
Detect <threads.h> availability and use standard C11 thread primitives when present, falling back to pthread or Windows implementations otherwise CI
This also adds a new Linux build (#12) using a Fedora Rawhide container to test against glibc 2.43