The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(build): pin the ARM64 cargo linker from VCToolsInstallDir, not PATH
ethernete6446eb72e1a
diff --git a/scripts/windows-build-deps.ps1 b/scripts/windows-build-deps.ps1index a06f6c9a4f9..3d2ed525932 100644--- a/scripts/windows-build-deps.ps1+++ b/scripts/windows-build-deps.ps1@@ -122,9 +122,13 @@ function Initialize-HermesArm64BuildTools {if (-not (Get-Command cl.exe -ErrorAction SilentlyContinue)) { throw 'ARM64 C++ compiler is unavailable after environment setup' }# With VSCMD_ARG_TGT_ARCH exported, rustc's cc crate takes link.exe from PATH# instead of asking vswhere. Under Git Bash that is coreutils' link.exe, so- # pin the MSVC linker explicitly.- $linker = (Get-Command link.exe -ErrorAction Stop).Source- if ($linker -notlike '*\MSVC\*') { throw "MSVC link.exe is shadowed by $linker" }+ # pin the MSVC linker explicitly. PATH order is the caller's (a reused+ # environment keeps Git Bash's order), so take it from the developer+ # environment's own tools directory instead.+ $linker = if ($env:VCToolsInstallDir) { Join-Path $env:VCToolsInstallDir 'bin\HostARM64\ARM64\link.exe' }+ if (-not $linker -or -not (Test-Path -LiteralPath $linker)) {+ throw "MSVC link.exe is missing from VCToolsInstallDir '$env:VCToolsInstallDir'"+ }$env:CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER = $linker# Child builds isolate HOME/USERPROFILE. Keep Rust anchored to the homesdiff --git a/tests/pm/test_windows_build_deps.py b/tests/pm/test_windows_build_deps.pyindex 4b35784ca65..c550158125a 100644--- a/tests/pm/test_windows_build_deps.py+++ b/tests/pm/test_windows_build_deps.py@@ -139,6 +139,10 @@ $ErrorActionPreference = 'Stop'$vs = Join-Path $Root 'VS with spaces'$devDir = Join-Path $vs 'Common7\Tools'New-Item -ItemType Directory -Force $devDir | Out-Null+# The MSVC linker pin comes from VsDevCmd's VCToolsInstallDir, never from PATH lookup.+$msvcBin = Join-Path $vs 'VC\Tools\MSVC\14.44\bin\HostARM64\ARM64'+New-Item -ItemType Directory -Force $msvcBin | Out-Null+[IO.File]::WriteAllText((Join-Path $msvcBin 'link.exe'), 'fixture')[IO.File]::WriteAllText((Join-Path $devDir 'VsDevCmd.bat'), @"@echo offset "PATH=%~dp0;%PATH%"@@ -147,6 +151,7 @@ set "LIB=fixture SDK lib"set "VSCMD_ARG_HOST_ARCH=arm64"set "VSCMD_ARG_TGT_ARCH=arm64"set "VSINSTALLDIR=$vs\"+set "VCToolsInstallDir=$vs\VC\Tools\MSVC\14.44\""@)$rustcPath = Join-Path $Root 'rustc.cmd'[IO.File]::WriteAllText($rustcPath, "@echo off`r`necho host: aarch64-pc-windows-msvc`r`n")@@ -165,9 +170,6 @@ function Get-Command {param([string]$Name)switch ($Name) {'cl.exe' { return [pscustomobject]@{Source = (Join-Path $vs 'cl.exe')} }- # The MSVC linker pin (CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER) resolves link.exe;- # a path under \MSVC\ is what the helper accepts.- 'link.exe' { return [pscustomobject]@{Source = (Join-Path $vs 'VC\Tools\MSVC\14.44\bin\HostARM64\ARM64\link.exe')} }'rustup.exe' { return [pscustomobject]@{Source = (Join-Path $Root 'rustup.exe')} }'rustc.exe' { return [pscustomobject]@{Source = $rustcPath} }'vcpkg.exe' { return $null }