Detect Windows-on-ARM in dir_build under an emulated shell
Some checks failed
CI / Detect changes (push) Has been cancelled
CI / Utilities Tests (push) Has been cancelled
CI / Build, Upload (push) Has been cancelled
CI / Test () (push) Has been cancelled
CI / Test (macOS NFS) (push) Has been cancelled
CI / Test (Windows arm64) (push) Has been cancelled
CI / Test (Windows x64) (push) Has been cancelled

uname reports x86_64 in an emulated x64 shell, so the staged build got
the wrong architecture.
This commit is contained in:
Dan Stillman 2026-08-19 16:21:59 -04:00
parent f371240414
commit 74336ae253

View file

@ -76,10 +76,16 @@ if [[ $platform = "m" ]]; then
else
# Windows / Linux: derive arch if not supplied
if [[ -z $arch ]]; then
case "$(uname -m)" in
arm64|aarch64) arch="arm64" ;;
x86_64) arch="x64" ;;
esac
# On Windows on ARM, an emulated x64 shell reports x86_64 from uname, so check
# the native architecture in the registry
if [[ $platform = "w" ]] && reg.exe query 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -v PROCESSOR_ARCHITECTURE 2> /dev/null | grep -q ARM64; then
arch="arm64"
else
case "$(uname -m)" in
arm64|aarch64) arch="arm64" ;;
x86_64) arch="x64" ;;
esac
fi
fi
fi