Description
The Windows Arm64 jobs in the CI recently started failing on 3.14 (for example). Noted by @StanFromIreland in #158188 (comment): the _freeze_module
Lines 20 to 21 in 9def455
| <FreezeProjects> | |
| <Platform>$(PreferredToolArchitecture)</Platform> |
can no longer be compiled for
PreferredToolArchitecture=x86 and PlatformToolset=v143:
The build tools for Visual Studio 2022 (Platform Toolset = 'v143') cannot be found.
PreferredToolArchitecture=x86 is chosen, because we use the x86 version of msbuild in CI:
"C:\Program Files\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin\msbuild.exe"
which is chosen by build.bat if no MSBUILD environment variable is set and msbuild is not in the path. 1
Compiling the _freeze_module for arm64 on an arm64 host by just using the arm64 version of msbuild would solve this, by e.g. just adding
env:
MSBUILD: ${{ inputs.arch == 'arm64' && 'C:\Program Files\Microsoft Visual Studio\18\Enterprise\MSBuild\Current\Bin\arm64\msbuild.exe' || '' }}
to
cpython/.github/workflows/reusable-windows.yml
Lines 38 to 40 in e16b12b
| - name: Build CPython | |
| run: >- | |
| .\\PCbuild\\build.bat |
because then
PreferredToolArchitecture=arm64 and also the arm64 version of the compiler is chosen.
I think running the _freeze_module natively on an arm64 host is anyway the better fit?
Footnotes
-
noticed already in https://github.com/python/cpython/issues/153668#issuecomment-5304195008 ↩
Activity
chris-eibl commentedon Sep 26, 2026
Note, we cannot override
PreferredToolArchitectureif we use thex86version of msbuild viadue
PROCESSOR_ARCHITECTURE=x86in this case, and viaC:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Microsoft\VC\v180\Microsoft.Cpp.ToolsetLocation.props:we always get
PreferredToolArchitecture=x86. This is also the default, hence in all builds so far:Why this does not work anymore for the latest
windows-11-armimage is not clear to me, especially because these compilers are part of itso
14.44.35207\bin\HostX86\x86should be found.Details
See https://github.com/chris-eibl/cpython/actions/runs/36241148789/job/108401760423 in my fork.
chris-eibl commentedon Sep 26, 2026
Short summary:
Running the
_freeze_modulenatively on an arm64 host could be done in main as well and would fix 3.14 without the need of migrating to v145, which was done to get 3.14 CI green via backporting:which could be reverted again.
Otherwise:
The current situation in 3.14 CI is that
Regarding official releases, AFAIU we could achieve the same (or even stick with v143 for Arm) since we cross-compile and only run the PGO step on @zooba's Azure VM (at least that's my understanding): we'd simply have to use the respective image, that is windows-2022 instead of windows-2025. For the first we get v143, for the latter v145, since this is chosen when VS 2026 is available now on 3.14. Previously, we've used v143 in this case, too.
Compiling and running the
_freeze_modulenatively works on the newwindows-11-armimage, tested here:https://github.com/chris-eibl/cpython/actions/runs/36245087168/job/108412696751
note the
chris-eibl commentedon Sep 26, 2026
@zware I have not yet found out why on your ARM64 Windows 3.x bot
is chosen to build the
_freeze_module, see e.g. https://buildbot.python.org/#/builders/729/builds/11426/steps/2/logs/stdio.On my D4ps v6 VM in Azure,
bin\HostX86\x86\CL.exeis taken by default like in CI.Only one of
MSBUILDto the arm64 versionPATHvcvarsarm64.battricks me into
bin\HostArm64\arm64\CL.exethere.Have you done anything of the above or maybe something even simpler?
zware commentedon Sep 27, 2026
I do in fact have
MSBUILDset on that worker; see line 19 for example. I found that was the only way to get a build to succeed at all with available RAM.chris-eibl commentedon Sep 27, 2026
Yupp, I forgot to emphasize that using the native msbuild would of course use the native compiler for the whole build, which is an even stronger motivation.
Another way to achive that: react on
PROCESSOR_ARCHITECTUREinbuild.batto prefer the native msbuild which then uses the native compiler tool chain.Btw, for the same reason, in the whole non-arm CI currently
HostX86is used - and most probably all build bots, except they do setMSBUILDorPreferredToolArchitecture(which I think is close to zero).Using the native compiler tool chain would also give us faster compilation and lesser likelihood that the compiler runs out of memory.
zooba commentedon Sep 28, 2026
I think it's totally fine for buildbots to override either of those variables to get a native MSBuild/native build tools.
I also don't have a problem with the use of a newer toolset, provided it's going to be used for release builds as well and the
vcruntimetag incpython-bin-depsgets updated.Keeping the older toolsets in some buildbots is a nice way to make sure we don't adopt brand new features too eagerly, but compatibility has been good enough that I'm not concerned about whether a contributor will probably be able to use their existing v143 while buildbots are running v145.