Skip to content

Commit 19fc2a8

Browse files
lixun910claude
andauthored
ci: fix Windows arm64 build after VS2026 runner image migration
The windows-11-arm runner label moved to the Windows 11 Arm64 VS 2026 image at the end of September 2026 (actions/runner-images#14602), which broke this job in master in three ways: - the hardcoded "...\2022\Enterprise\Common7\Tools\VsDevCmd.bat" no longer exists ("The system cannot find the path specified") -- resolve Visual Studio with vswhere instead; - Boost 1.88's bootstrap only knows toolsets up to vc143 and dies with "Unknown toolset: vcunk" on the VS 2026 image, so the arm64 dependency chain cannot be built there -- build arm64 on windows-2022 and cross-compile with -arch=arm64, as the x64/x86 jobs already do; - cross-compiling needs the host tool directories VsDevCmd leaves off PATH: the target toolset bin dir (or "link" resolves to Git for Windows' coreutils link.exe), the host toolset dirs for nmake, and the x64 SDK tools, because an arm64 rc.exe cannot run on the x64 runner. The step now reports where cl, link, nmake and rc resolve, and fails in seconds if the environment cannot be assembled rather than an hour into a build. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent f7696a4 commit 19fc2a8

1 file changed

Lines changed: 63 additions & 2 deletions

File tree

‎.github/workflows/windows_build.yml‎

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@ jobs:
3939
MSVC_VER: 1930
4040
platform: x86
4141
runner: windows-2022
42+
# arm64 is cross-compiled on the x64 runner. The windows-11-arm
43+
# image moved to Visual Studio 2026 (actions/runner-images#14602),
44+
# whose toolset Boost 1.88's bootstrap does not recognise ("Unknown
45+
# toolset: vcunk"), so the arm64 dependency chain cannot be built
46+
# there. windows-2022 still ships VS 2022 (v143) plus the ARM64
47+
# build tools, and -arch=arm64 cross-compiles against them.
4248
- VS_VERSION: Visual Studio 17
4349
VS_VER: 2022
4450
MSVC_VER: 1930
4551
platform: arm64
46-
runner: windows-11-arm
52+
runner: windows-2022
4753

4854
env:
4955
VS_VERSION: ${{ matrix.VS_VERSION }}
@@ -86,10 +92,65 @@ jobs:
8692
echo "::set-env name=WIN64_ARG::$env:WIN64_ARG"
8793
8894
# Set compiler environment
95+
#
96+
# Locate Visual Studio with vswhere instead of a hardcoded path. At the
97+
# end of September 2026 GitHub migrated the windows-11-arm label from a
98+
# VS 2022 image ("...\2022\Enterprise") to a VS 2026 one
99+
# ("...\18\Enterprise"), which broke the old fixed path. Resolving the
100+
# install location keeps this working across that and future changes.
89101
- name: Set compiler environment
90102
shell: cmd
91103
run: |
92-
if "%VS_VER%" == "2022" CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=%ARCHITECTURE%
104+
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
105+
set "VSPATH="
106+
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -prerelease -products * -property installationPath 2^>nul`) do set "VSPATH=%%i"
107+
if not defined VSPATH if exist "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" set "VSPATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
108+
if not defined VSPATH (
109+
echo ERROR: could not locate a Visual Studio installation.
110+
exit /b 1
111+
)
112+
echo Using Visual Studio at "%VSPATH%"
113+
CALL "%VSPATH%\Common7\Tools\VsDevCmd.bat" -arch=%ARCHITECTURE%
114+
rem VsDevCmd sets INCLUDE/LIB for the target but leaves the
115+
rem toolset's bin directory off PATH. The dependency builds invoke
116+
rem cl/link/nmake by bare name, so on the runner they either are not
117+
rem found or resolve to Git for Windows' own link.exe
118+
rem ("/usr/bin/link: extra operand ..."), which fails the wxWidgets
119+
rem build and later the GeoDa link with LNK1181 wxmsw31u.lib.
120+
rem Put the target toolset first, then the host ones -- nmake lives
121+
rem in the host directory, not in the arm64 cross directory.
122+
set "TARGETDIR=%ARCHITECTURE%"
123+
if /i "%TARGETDIR%"=="amd64" set "TARGETDIR=x64"
124+
set "VCTOOLS="
125+
for /d %%d in ("%VSPATH%\VC\Tools\MSVC\*") do set "VCTOOLS=%%d"
126+
set "TARGETBIN="
127+
if defined VCTOOLS if exist "%VCTOOLS%\bin\HostX64\%TARGETDIR%\cl.exe" set "TARGETBIN=%VCTOOLS%\bin\HostX64\%TARGETDIR%"
128+
if not defined TARGETBIN if defined VCTOOLS if exist "%VCTOOLS%\bin\HostX86\%TARGETDIR%\cl.exe" set "TARGETBIN=%VCTOOLS%\bin\HostX86\%TARGETDIR%"
129+
if not defined TARGETBIN (
130+
echo ERROR: no MSVC %TARGETDIR% toolset found under "%VSPATH%".
131+
exit /b 1
132+
)
133+
rem The Windows SDK ships its tools per host architecture too, and
134+
rem VsDevCmd puts the arm64 ones on PATH. An arm64 rc.exe cannot run
135+
rem on the x64 runner ("This version of %1 is not compatible with the
136+
rem version of Windows you're running"), so prefer the x64 SDK tools --
137+
rem they target arm64 just as well, and this is what MSBuild does for
138+
rem cross builds.
139+
set "SDKBIN="
140+
if defined WindowsSdkDir if defined WindowsSDKVersion if exist "%WindowsSdkDir%bin\%WindowsSDKVersion%x64\rc.exe" set "SDKBIN=%WindowsSdkDir%bin\%WindowsSDKVersion%x64"
141+
if not defined SDKBIN if defined WindowsSdkDir for /d %%d in ("%WindowsSdkDir%bin\10.*") do set "SDKBIN=%%d\x64"
142+
set "PREPEND=%TARGETBIN%;%VCTOOLS%\bin\HostX64\x64;%VCTOOLS%\bin\HostX86\x86"
143+
if defined SDKBIN set "PREPEND=%SDKBIN%;%PREPEND%"
144+
set "PATH=%PREPEND%;%PATH%"
145+
where cl
146+
where link
147+
where nmake
148+
where rc
149+
where cl >nul 2>&1 && where link >nul 2>&1 && where nmake >nul 2>&1 && where rc >nul 2>&1
150+
if errorlevel 1 (
151+
echo ERROR: cl.exe, link.exe, nmake.exe or rc.exe is missing from PATH.
152+
exit /b 1
153+
)
93154
echo ::set-env name=PATH::%PATH%
94155
echo ::set-env name=INCLUDE::%INCLUDE%
95156
echo ::set-env name=LIB::%LIB%

0 commit comments

Comments
 (0)