windows-miner: fallback only when the toolset import left LIB empty

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-josh 2026-10-03 19:41:40 +00:00
parent 5287e60b5a
commit fcff6d56a6

View file

@ -116,9 +116,9 @@ if ($haveCl) {
$libFirst = if ($env:LIB) { ($env:LIB -split ';')[0] } else { 'EMPTY' }
$incFirst = if ($env:INCLUDE) { ($env:INCLUDE -split ';')[0] } else { 'EMPTY' }
Log "MSVC environment: cl at $((Get-Command cl.exe).Source); LIB starts with $libFirst; INCLUDE starts with $incFirst"
# Always add the newest MSVC lib dir and the Windows Kits dirs in front of LIB: a vcvars import can leave LIB without
# the MSVC lib directory (seen on Josh's PC: LIB started with ucrt and nvcc's link failed on LIBCMT.lib).
[void](Set-LibFallback); Log ('LIB now starts with ' + (($env:LIB -split ';')[0]))
# The fallback only when the import left nothing: it would otherwise put the newest toolset's headers in front of
# INCLUDE and CUDA 12.8's cudafe++ crashes on those. The library path for nvcc's link step comes from build.bat itself.
if (-not $env:LIB) { Log 'LIB is empty: trying the fallback'; [void](Set-LibFallback) }
}
$haveNvcc = [bool](Get-Command nvcc.exe -ErrorAction SilentlyContinue)
$openclSdk = $null