From b9a5fd0708c3b9647bd6d99f976fabe0d8395c3c Mon Sep 17 00:00:00 2001 From: Stephen Roberts Date: Sun, 7 Jun 2026 10:31:33 +1000 Subject: [PATCH] Bundle MinGW runtime DLLs into Windows wheels via delvewheel cibuildwheel repairs Linux (auditwheel) and macOS (delocate) wheels by default but does nothing on Windows, so the MinGW-built extension ships without its runtime DLLs. _internals.pyd imports libgcc_s_seh-1.dll and libstdc++-6.dll, which aren't bundled and aren't present on a clean Windows Python, so `import meshpy.triangle` fails with "DLL load failed while importing _internals". This also breaks downstreams such as `pip install anuga`. Add the documented cibuildwheel Windows repair: install delvewheel before the build and run `delvewheel repair` so the runtime DLLs are bundled and the wheel is self-contained. Linux and macOS are unaffected. Fixes #150 Co-Authored-By: Claude Opus 4.8 --- .github/workflows/wheels.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a45ca36..e5e10fe 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -44,6 +44,15 @@ jobs: uses: pypa/cibuildwheel@v3.4.1 env: CIBW_SKIP: "*-musllinux_i686 *-manylinux_i686 *-win32 cp31?t-*" + # Make the Windows wheels self-contained. cibuildwheel repairs Linux + # (auditwheel) and macOS (delocate) wheels by default, but does + # nothing on Windows. The extension is built with MinGW, so the wheel + # otherwise ships without its runtime DLLs (libstdc++-6.dll, + # libgcc_s_seh-1.dll) and fails to import on a clean Windows Python + # ("DLL load failed while importing _internals"). delvewheel bundles + # them. See https://github.com/inducer/meshpy/issues/150 + CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" - uses: actions/upload-artifact@v7 with: