Regression in 0.12.0: wrong architecture selected when building for Python x86 on Windows x64 host
### Description
After upgrading from `scikit-build-core 0.11.6` to `0.12.0`, building a package that targets **Python 3.13 x86 (win32)** on a **Windows x64 host** fails with a linker architecture mismatch. The build was working correctly with `0.11.6`.
This appears to be a regression introduced by the cross-compilation changes in #1050 (`Better support for cross-compilation`) and/or #1196 (`Respect _PYTHON_HOST_PLATFORM env variable`).
### Environment
- **scikit-build-core**: 0.12.0 (regression), works on 0.11.6
- **CMake**: 3.31.6
- **MSVC**: 19.44.35222.0 (Visual Studio 17 2022)
- **Python**: 3.13.12 x86 (`C:\hostedtoolcache\windows\Python\3.13.12\x86`)
- **Host OS**: Windows (GitHub Actions `windows-latest` / `windows-2025`)
- **Package being built**: `h3==4.3.0` (uses scikit-build-core as build backend)
### Steps to reproduce
1. Use GitHub Actions `windows-latest` runner
2. Install Python 3.13 x86 (`architecture: x86` in `actions/setup-python`)
3. Attempt to build `h3==4.3.0` from source using `uv sync` or `pip install`
### Error
```
-- Building for: Visual Studio 17 2022
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe
warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
fatal error LNK1120: 190 unresolved externals
```
CMake correctly detects Python as x86:
```
-- Found Python: ...\Python\3.13.12\x86\python.exe (found version "3.13.12")
```
But selects `Hostx64/x64/cl.exe` instead of the x86 compiler, causing the linker to fail when linking against `python313.lib` (x86).
### Expected behavior
scikit-build-core should select the correct x86 toolchain when the target Python is x86, as it did in 0.11.6.
### Workaround
Pinning `scikit-build-core` to `0.11.6` via uv's `extra-build-dependencies`:
```toml
[tool.uv.extra-build-dependencies]
h3 = ["scikit-build-core==0.11.6"]
```
2 条评论