Bundle MinGW runtime DLLs into Windows wheels (delvewheel)#151
Conversation
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 inducer#150 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks for this PR. It turns out that cibuildwheel 4 has started automatically running https://cibuildwheel.pypa.io/en/stable/changelog/#v400 The bump to that went in this morning in #152. Does that make this PR redundant? (You can grab built wheels from the wheel build artifacts I think, in case that's helpful.) |
|
Confirmed redundant — closing. I verified the Windows wheel built from |
Fixes #150.
Problem
cibuildwheel repairs Linux wheels (auditwheel → manylinux) and macOS wheels (delocate) by default, but does not run a repair step on Windows. The extension is built with MinGW, so the published
win_amd64wheels ship without their runtime DLLs and fail to import on a clean Windows Python:_internals.*.pydimportslibgcc_s_seh-1.dllandlibstdc++-6.dll(confirmed viapefile), neither of which is bundled in the wheel or present on a stock Windows Python. This also breaks downstreams — e.g.pip install anuga, which depends on meshpy.Fix
Add the documented cibuildwheel Windows repair step using
delvewheel, which bundles the dependent DLLs and rewrites the load paths so the wheel is self-contained:The MinGW runtime DLLs are on
PATHduring the build (that's how meson finds gcc), so delvewheel locates and bundles them. Linux and macOS builds are unaffected.Verifying
This PR's
Build wheelsrun produces the Windows wheels; the repaired wheel should contain the bundled DLLs undermeshpy.libs/(e.g.delvewheeladdslibstdc++-6,libgcc_s_seh-1,libwinpthread-1), andimport meshpy.trianglethen works in a clean venv with no MinGW onPATH.🤖 Generated with Claude Code