Skip to content

Comments

Add MinGW/MSYS2 build support#485

Open
robtaylor wants to merge 2 commits intoberkeley-abc:masterfrom
robtaylor:mingw-build-support
Open

Add MinGW/MSYS2 build support#485
robtaylor wants to merge 2 commits intoberkeley-abc:masterfrom
robtaylor:mingw-build-support

Conversation

@robtaylor
Copy link

Summary

Add support for building ABC with MinGW/MSYS2 on Windows, providing an alternative Windows build path using the GNU toolchain.

Build fixes (commit 1)

  • Use stdatomic.h on MinGW instead of MSVC Interlocked functions. MinGW defines _WIN32 but has <stdatomic.h> unlike MSVC — fix guards in utilPth.c and sswPart.c.
  • Exclude -ldl and -lrt from link libraries on MINGW/MSYS platforms (these Unix-only libraries don't exist on MinGW).
  • Add -lshlwapi on MINGW/MSYS for PathMatchSpec used in sclLiberty.c.

New CI workflow (commit 2)

  • Add a new, separate build-mingw.yml workflow (does not modify any existing workflow files).
  • Uses MSYS2 with mingw-w64-x86_64-gcc on windows-latest.
  • Uses ABC_USE_STDINT_H=1 and -DWIN32 -DWIN32_NO_DLL flags to handle MinGW platform quirks (32-bit long on 64-bit Windows, missing WIN32 define).

Test plan

  • Tested on robtaylor/abc CI — MinGW build passes
  • Verify existing posix and Windows CI jobs are unaffected (no changes to existing workflows)

- Use stdatomic.h on MinGW instead of MSVC Interlocked functions.
  MinGW defines _WIN32 but has <stdatomic.h> unlike MSVC. Fix guards
  in utilPth.c and sswPart.c.
- Exclude -ldl and -lrt from link libraries on MINGW/MSYS platforms,
  as these Unix-only libraries don't exist on MinGW.
- Add -lshlwapi on MINGW/MSYS for PathMatchSpec used in sclLiberty.c.

Co-developed-by: Claude Code v2.1.39 (claude-opus-4-6)
Add a new GitHub Actions workflow for building ABC with MinGW/MSYS2
on Windows. This provides an alternative Windows build path using
the GNU toolchain via MSYS2's mingw-w64-x86_64-gcc.

The workflow uses ABC_USE_STDINT_H=1 and -DWIN32 -DWIN32_NO_DLL
flags to handle MinGW platform quirks (32-bit long on 64-bit
Windows, missing WIN32 define in MinGW).

Co-developed-by: Claude Code v2.1.39 (claude-opus-4-6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant