Skip to content

Commit 53a626c

Browse files
committed
Update shared-key in setup-rust action to version 5 for improved cache management and enhance compiler detection in setup-system action by forcing MSVC's cl.exe for both detection and compilation, ensuring compatibility and preventing linker errors.
1 parent e16069f commit 53a626c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/actions/setup-rust/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ runs:
6161
with:
6262
key: ${{ inputs.target }}
6363
save-if: ${{ inputs.save-cache }}
64-
shared-key: stable-cache-v4
64+
shared-key: stable-cache-v5
6565

6666
# TODO: Re-enable cargo config generation when preprep.mjs is ported
6767
# For now, use cargo's defaults which work fine without native deps

.github/actions/setup-system/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,22 @@ runs:
8080
# 4. Set LIBCLANG_PATH for bindgen (points to our LLVM where libclang.dll lives)
8181
echo "LIBCLANG_PATH=$llvmBin" >> $env:GITHUB_ENV
8282
83-
# 5. Find cl.exe full path via vswhere and set CMAKE_C_COMPILER
83+
# 5. Find cl.exe full path via vswhere and force it for ALL compiler detection.
84+
# aws-lc-sys uses the `cc` crate (not CMAKE_C_COMPILER) to detect the compiler.
85+
# If it finds clang-cl, it enables __builtin_bswap support, but CMake then compiles
86+
# with MSVC which doesn't know those builtins → linker error.
87+
# Setting CC forces the cc crate to use MSVC for both detection AND compilation.
8488
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
8589
-latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
8690
-property installationPath
8791
$msvcVer = (Get-Content "$vsPath\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt").Trim()
8892
$clExe = "$vsPath\VC\Tools\MSVC\$msvcVer\bin\HostX64\x64\cl.exe"
8993
if (Test-Path $clExe) {
94+
echo "CC=$clExe" >> $env:GITHUB_ENV
95+
echo "CXX=$clExe" >> $env:GITHUB_ENV
9096
echo "CMAKE_C_COMPILER=$clExe" >> $env:GITHUB_ENV
9197
echo "CMAKE_CXX_COMPILER=$clExe" >> $env:GITHUB_ENV
92-
Write-Host "Set CMAKE_C_COMPILER to $clExe"
98+
Write-Host "Set CC and CMAKE_C_COMPILER to $clExe"
9399
} else {
94100
Write-Error "Could not find cl.exe at $clExe"
95101
exit 1

0 commit comments

Comments
 (0)