-
Notifications
You must be signed in to change notification settings - Fork 99
Use POSIX on Windows when building with mingw-w64 toolchain #1098
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
Conversation
kevinAlbs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There is the possibility that
_WIN32_WINNTcould be used per this SO post
Aside: I expect defining _WIN32_WINNT would work based on the latest MinGW headers. Defining _WIN32_WINNT might be slightly preferable to avoid any quirks in another thread implementation (MinGW's implementation looks non-trivial). But I think that is a minimal risk.
I have a suspicion that the "proper" fix (if we want to continue using Win32 threads, which I'm not sure we want to) may be to set an appropriate value for the We may also need to eventually decide and publically document exactly what we mean by "mingw" support, considering the wide parameter space of "mingw" toolchains available (ucrt vs. msvcrt vs. MCF runtime libraries, pthread vs. win32 threads, SEH vs. SJLJ exceptions, i686 vs. x86_64 target architectures). As far as I am aware, the most likely and recommended configuration used and expected by modern Windows development environments is |
|
On second thought, we may want to go with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but your decision whether to go through with it.
Will postpone considering this alternative solution for the future, given these changes should only affect internal code (not part of public API, unlike |
Related to CXX-3180. Addresses the following compilation error observed when built with mingw-w64 GCC on Windows:
Given systems where mingw-w64 GCC toolchains are installed typically include the POSIX library, this PR propoes restricting the conditions used to select Windows headers to "building with MSVC" (
defined(_MSC_VER)) only instead of "targeting Windows" (defined(_WIN32)).(There is the possibility that
_WIN32_WINNTcould be used per this SO post, but I'd prefer not to introduce Windows-specific library configuration macros if we can help it.)