Skip to content

Fix building on Windows with MSYS2#192

Closed
500-internal-server-error wants to merge 7 commits intogulrak:masterfrom
500-internal-server-error:fix-windows-mingw-clang
Closed

Fix building on Windows with MSYS2#192
500-internal-server-error wants to merge 7 commits intogulrak:masterfrom
500-internal-server-error:fix-windows-mingw-clang

Conversation

@500-internal-server-error
Copy link

@500-internal-server-error 500-internal-server-error commented Feb 19, 2025

This PR:

  • fixes building on Windows with MSYS2 UCRT64 GCC (adds -mbig-obj to CXXFLAGS by default for MinGW in general, instead of just Cygwin)
  • fixes building on Windows with MSYS2 CLANG64 Clang (modifies the #ifdefss around the GCC #pragmas to also work for Clang, and adds more to fix the things Clang catches that GCC doesn't)
  • adds MSYS2 to CI

Tests against std::filesystem remain broken, and must be disabled using -DGHC_FILESYSTEM_BUILD_STD_TEST=NO, but at least -DCMAKE_CXX_FLAGS=-Wa,-mbig-obj is no longer required to be passed explicitly.

If any of the above are undesirable, it can be reverted and/or added in a separate PR.

Fixes #189

Apply GCC `#pragma`s to Clang too, and also more to fix the things Clang
catches that GCC doesn't
It's already being done for Cygwin, presumably for the same reasons.
Clang auto-applies `-mbig-obj` as needed it seems:
https://reviews.llvm.org/D102419

Tests against `std::filesystem` remain broken, though, and building
with MinGW still requires disabling them manually with
`-DGHC_FILESYSTEM_BUILD_STD_TESTING=NO`:
#189 (comment)
@gulrak gulrak self-requested a review December 28, 2025 11:36
@gulrak
Copy link
Owner

gulrak commented Dec 31, 2025

Thank you so much for the PR, sadly due to me staying away from the project for too long, my workflow was failing already and I used that to redo it, making it hard to merge this now. I have made an MSYS2 workflow supporting the three compilers, based on my new workflow file and basically your changes to filesystem.hpp , in https://github.com/gulrak/filesystem/tree/dev-msys2-workflow, so I would merge that, hoping that is okay with you and giving you a shoutout in the readme changes.

@500-internal-server-error
Copy link
Author

No worries, I don't mind :) Feel free to close.

@gulrak
Copy link
Owner

gulrak commented Dec 31, 2025

Thanks again for the contribution, it has basically resulted in #199, which implements this using the redone workflow.

@gulrak gulrak closed this Dec 31, 2025
@gulrak gulrak added the available on master Fix is done on master branch, issue closed on next release label Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

available on master Fix is done on master branch, issue closed on next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doesn't build on Windows MSYS2 MinGW/Clang

2 participants