Skip to content

Commit e56e2dd

Browse files
kkraus14cursoragent
andcommitted
Fix Windows link.exe: rename Git's link.exe via CIBW_BEFORE_BUILD
The $VCToolsInstallDir PATH prepend via CIBW_ENVIRONMENT_WINDOWS did not take effect. Instead, rename Git's /usr/bin/link.exe (POSIX hardlink tool) before each cibuildwheel build so MSVC's linker is found on PATH when DISTUTILS_USE_SDK=1 skips vcvarsall.bat. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 8214ad1 commit e56e2dd

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/build-wheel.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,16 @@ jobs:
178178
SCCACHE_DIR=/host/${{ env.SCCACHE_DIR }}
179179
SCCACHE_CACHE_SIZE=${{ env.SCCACHE_CACHE_SIZE }}
180180
CIBW_ENVIRONMENT_PASS_WINDOWS: >
181-
DISTUTILS_USE_SDK INCLUDE LIB VCToolsInstallDir
181+
DISTUTILS_USE_SDK INCLUDE LIB
182182
CIBW_ENVIRONMENT_WINDOWS: >
183183
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
184184
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
185-
PATH="$VCToolsInstallDir/bin/Hostx64/x64;$PATH"
185+
# Git ships /usr/bin/link.exe (POSIX hardlink tool) which shadows
186+
# MSVC's linker when DISTUTILS_USE_SDK=1 skips vcvarsall.bat.
187+
CIBW_BEFORE_BUILD_WINDOWS: >
188+
pip install delvewheel &&
189+
if exist "C:\Program Files\Git\usr\bin\link.exe"
190+
(rename "C:\Program Files\Git\usr\bin\link.exe" link.exe.bak)
186191
# check cache stats before leaving cibuildwheel
187192
CIBW_BEFORE_TEST_LINUX: >
188193
"/host/${{ env.SCCACHE_PATH }}" --show-stats
@@ -237,13 +242,16 @@ jobs:
237242
SCCACHE_DIR=/host/${{ env.SCCACHE_DIR }}
238243
SCCACHE_CACHE_SIZE=${{ env.SCCACHE_CACHE_SIZE }}
239244
CIBW_ENVIRONMENT_PASS_WINDOWS: >
240-
DISTUTILS_USE_SDK INCLUDE LIB VCToolsInstallDir
245+
DISTUTILS_USE_SDK INCLUDE LIB
241246
CIBW_ENVIRONMENT_WINDOWS: >
242247
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
243248
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
244249
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_CUDA_MAJOR }}
245250
PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
246-
PATH="$VCToolsInstallDir/bin/Hostx64/x64;$PATH"
251+
CIBW_BEFORE_BUILD_WINDOWS: >
252+
pip install delvewheel &&
253+
if exist "C:\Program Files\Git\usr\bin\link.exe"
254+
(rename "C:\Program Files\Git\usr\bin\link.exe" link.exe.bak)
247255
# check cache stats before leaving cibuildwheel
248256
CIBW_BEFORE_TEST_LINUX: >
249257
"/host${{ env.SCCACHE_PATH }}" --show-stats
@@ -436,13 +444,16 @@ jobs:
436444
SCCACHE_DIR=/host/${{ env.SCCACHE_DIR }}
437445
SCCACHE_CACHE_SIZE=${{ env.SCCACHE_CACHE_SIZE }}
438446
CIBW_ENVIRONMENT_PASS_WINDOWS: >
439-
DISTUTILS_USE_SDK INCLUDE LIB VCToolsInstallDir
447+
DISTUTILS_USE_SDK INCLUDE LIB
440448
CIBW_ENVIRONMENT_WINDOWS: >
441449
CUDA_PATH="$(cygpath -w ${{ env.CUDA_PATH }})"
442450
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
443451
CUDA_CORE_BUILD_MAJOR=${{ env.BUILD_PREV_CUDA_MAJOR }}
444452
PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
445-
PATH="$VCToolsInstallDir/bin/Hostx64/x64;$PATH"
453+
CIBW_BEFORE_BUILD_WINDOWS: >
454+
pip install delvewheel &&
455+
if exist "C:\Program Files\Git\usr\bin\link.exe"
456+
(rename "C:\Program Files\Git\usr\bin\link.exe" link.exe.bak)
446457
# check cache stats before leaving cibuildwheel
447458
CIBW_BEFORE_TEST_LINUX: >
448459
"/host${{ env.SCCACHE_PATH }}" --show-stats

0 commit comments

Comments
 (0)