Skip to content

Commit 071b1af

Browse files
Technologicatclaude
andcommitted
CI: add MSVC activation to the build-wheels Windows job too
The previous MSVC fix landed only in the `test` job, where I assumed cibuildwheel handled MSVC activation for its Windows wheel builds automatically. It does not — cibuildwheel's auto-MSVC logic applies to distutils/setuptools-based projects (where distutils itself knows how to invoke vcvarsall because Python is built with MSVC), but meson-python uses meson's own compiler discovery, which picks up the first C compiler on the runner PATH. On GitHub Actions' windows-latest, that first compiler is Strawberry Perl's bundled MinGW-w64 gcc 15.2.0 in C:\Strawberry\c\bin — confirmed in the wheel build log: C compiler for the host machine: C:\Strawberry\c\bin\ccache.EXE cc (gcc 15.2.0 "cc (x86_64-posix-seh-rev1, Built by MinGW-Builds project) 15.2.0") The resulting .pyd files link against libgomp-1.dll / libgcc_s_seh-1.dll which are not on the wheel-test environment's DLL search path, so cibuildwheel's own test phase fails with the same ImportError we already diagnosed for the test job. Fix: add `ilammy/msvc-dev-cmd@v1` step before the cibuildwheel step in the build-wheels job, conditional on runner.os == 'Windows'. The existing step in the test job is unchanged. Also update ~/.claude/CI-SETUP-NOTES.md and ~/.claude/CLAUDE.md to state that the MSVC activation step needs to land in BOTH jobs, not just the test job (my earlier writeup incorrectly claimed cibuildwheel handled the build-wheels side automatically). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 43911e7 commit 071b1af

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,20 @@ jobs:
9494
steps:
9595
- uses: actions/checkout@v6
9696

97+
# Same MSVC activation as in the test job, and for the same reason:
98+
# cibuildwheel does NOT automatically activate MSVC for meson-python
99+
# builds on Windows (unlike distutils/setuptools-based projects where
100+
# distutils auto-detects MSVC via the python-being-built-with logic).
101+
# Without this step, meson picks up Strawberry Perl's bundled
102+
# MinGW-w64 gcc from the runner PATH and the resulting .pyd files
103+
# link against libgomp-1.dll / libgcc_s_seh-1.dll, which are not
104+
# present in the wheel test environment.
105+
- uses: ilammy/msvc-dev-cmd@v1
106+
if: runner.os == 'Windows'
107+
97108
# cibuildwheel config lives in pyproject.toml ([tool.cibuildwheel]) —
98109
# build list, skip list, test-requires, test-command, and the macOS
99-
# before-all that installs libomp.
110+
# before-all that installs conda-forge llvm-openmp via micromamba.
100111
- uses: pypa/[email protected]
101112

102113
- uses: actions/upload-artifact@v7

0 commit comments

Comments
 (0)