Skip to content

Commit

Permalink
Auto merge of rust-lang#137665 - Kobzol:update-sccache, r=<try>
Browse files Browse the repository at this point in the history
Update sccache to 0.10.0

This time, does it also for Windows and macOS.

r? `@ghost`

try-job: dist-aarch64-apple
try-job: dist-x86_64-apple
try-job: dist-x86_64-msvc
try-job: dist-x86_64-msvc-alt
try-job: dist-i686-msvc
try-job: dist-aarch64-msvc
try-job: dist-x86_64-linux
  • Loading branch information
bors committed Mar 1, 2025
2 parents 0c72c0d + d369c98 commit 694c842
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 53 deletions.
96 changes: 48 additions & 48 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,56 +736,56 @@ fn configure_cmake(
};

// Handle msvc + ninja + ccache specially (this is what the bots use)
if target.is_msvc() && builder.ninja() && builder.config.ccache.is_some() {
let mut wrap_cc = env::current_exe().expect("failed to get cwd");
wrap_cc.set_file_name("sccache-plus-cl.exe");

cfg.define("CMAKE_C_COMPILER", sanitize_cc(&wrap_cc))
.define("CMAKE_CXX_COMPILER", sanitize_cc(&wrap_cc));
cfg.env("SCCACHE_PATH", builder.config.ccache.as_ref().unwrap())
.env("SCCACHE_TARGET", target.triple)
.env("SCCACHE_CC", &cc)
.env("SCCACHE_CXX", &cxx);

// Building LLVM on MSVC can be a little ludicrous at times. We're so far
// off the beaten path here that I'm not really sure this is even half
// supported any more. Here we're trying to:
//
// * Build LLVM on MSVC
// * Build LLVM with `clang-cl` instead of `cl.exe`
// * Build a project with `sccache`
// * Build for 32-bit as well
// * Build with Ninja
//
// For `cl.exe` there are different binaries to compile 32/64 bit which
// we use but for `clang-cl` there's only one which internally
// multiplexes via flags. As a result it appears that CMake's detection
// of a compiler's architecture and such on MSVC **doesn't** pass any
// custom flags we pass in CMAKE_CXX_FLAGS below. This means that if we
// use `clang-cl.exe` it's always diagnosed as a 64-bit compiler which
// definitely causes problems since all the env vars are pointing to
// 32-bit libraries.
//
// To hack around this... again... we pass an argument that's
// unconditionally passed in the sccache shim. This'll get CMake to
// correctly diagnose it's doing a 32-bit compilation and LLVM will
// internally configure itself appropriately.
if builder.config.llvm_clang_cl.is_some() && target.contains("i686") {
cfg.env("SCCACHE_EXTRA_ARGS", "-m32");
}
} else {
// If ccache is configured we inform the build a little differently how
// to invoke ccache while also invoking our compilers.
if use_compiler_launcher {
if let Some(ref ccache) = builder.config.ccache {
cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache)
.define("CMAKE_CXX_COMPILER_LAUNCHER", ccache);
}
// if target.is_msvc() && builder.ninja() && builder.config.ccache.is_some() {
// let mut wrap_cc = env::current_exe().expect("failed to get cwd");
// wrap_cc.set_file_name("sccache-plus-cl.exe");
//
// cfg.define("CMAKE_C_COMPILER", sanitize_cc(&wrap_cc))
// .define("CMAKE_CXX_COMPILER", sanitize_cc(&wrap_cc));
// cfg.env("SCCACHE_PATH", builder.config.ccache.as_ref().unwrap())
// .env("SCCACHE_TARGET", target.triple)
// .env("SCCACHE_CC", &cc)
// .env("SCCACHE_CXX", &cxx);
//
// // Building LLVM on MSVC can be a little ludicrous at times. We're so far
// // off the beaten path here that I'm not really sure this is even half
// // supported any more. Here we're trying to:
// //
// // * Build LLVM on MSVC
// // * Build LLVM with `clang-cl` instead of `cl.exe`
// // * Build a project with `sccache`
// // * Build for 32-bit as well
// // * Build with Ninja
// //
// // For `cl.exe` there are different binaries to compile 32/64 bit which
// // we use but for `clang-cl` there's only one which internally
// // multiplexes via flags. As a result it appears that CMake's detection
// // of a compiler's architecture and such on MSVC **doesn't** pass any
// // custom flags we pass in CMAKE_CXX_FLAGS below. This means that if we
// // use `clang-cl.exe` it's always diagnosed as a 64-bit compiler which
// // definitely causes problems since all the env vars are pointing to
// // 32-bit libraries.
// //
// // To hack around this... again... we pass an argument that's
// // unconditionally passed in the sccache shim. This'll get CMake to
// // correctly diagnose it's doing a 32-bit compilation and LLVM will
// // internally configure itself appropriately.
// if builder.config.llvm_clang_cl.is_some() && target.contains("i686") {
// cfg.env("SCCACHE_EXTRA_ARGS", "-m32");
// }
// } else {
// If ccache is configured we inform the build a little differently how
// to invoke ccache while also invoking our compilers.
if use_compiler_launcher {
if let Some(ref ccache) = builder.config.ccache {
cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache)
.define("CMAKE_CXX_COMPILER_LAUNCHER", ccache);
}
cfg.define("CMAKE_C_COMPILER", sanitize_cc(&cc))
.define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx))
.define("CMAKE_ASM_COMPILER", sanitize_cc(&cc));
}
cfg.define("CMAKE_C_COMPILER", sanitize_cc(&cc))
.define("CMAKE_CXX_COMPILER", sanitize_cc(&cxx))
.define("CMAKE_ASM_COMPILER", sanitize_cc(&cc));
// }

cfg.build_arg("-j").build_arg(builder.jobs().to_string());
// FIXME(madsmtm): Allow `cmake-rs` to select flags by itself by passing
Expand Down
4 changes: 2 additions & 2 deletions src/ci/docker/scripts/sccache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ set -ex

case "$(uname -m)" in
x86_64)
url="https://ci-mirrors.rust-lang.org/rustc/2025-01-07-sccache-v0.9.1-x86_64-unknown-linux-musl"
url="https://ci-mirrors.rust-lang.org/rustc/2025-02-24-sccache-v0.10.0-x86_64-unknown-linux-musl"
;;
aarch64)
url="https://ci-mirrors.rust-lang.org/rustc/2025-01-07-sccache-v0.9.1-aarch64-unknown-linux-musl"
url="https://ci-mirrors.rust-lang.org/rustc/2025-02-24-sccache-v0.10.0-aarch64-unknown-linux-musl"
;;
*)
echo "unsupported architecture: $(uname -m)"
Expand Down
2 changes: 1 addition & 1 deletion src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,5 @@ if [ "$RUN_CHECK_WITH_PARALLEL_QUERIES" != "" ]; then
fi

echo "::group::sccache stats"
sccache --show-stats || true
sccache --show-adv-stats || true
echo "::endgroup::"
4 changes: 2 additions & 2 deletions src/ci/scripts/install-sccache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ IFS=$'\n\t'
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

if isMacOS; then
curl -fo /usr/local/bin/sccache "${MIRRORS_BASE}/2021-08-25-sccache-v0.2.15-x86_64-apple-darwin"
curl -fo /usr/local/bin/sccache "${MIRRORS_BASE}/2025-02-24-sccache-v0.10.0-x86_64-apple-darwin"
chmod +x /usr/local/bin/sccache
elif isWindows; then
mkdir -p sccache
curl -fo sccache/sccache.exe "${MIRRORS_BASE}/2018-04-26-sccache-x86_64-pc-windows-msvc"
curl -fo sccache/sccache.exe "${MIRRORS_BASE}/2025-02-24-sccache-v0.10.0-x86_64-pc-windows-msvc.exe"
ciCommandAddPath "$(pwd)/sccache"
fi

Expand Down

0 comments on commit 694c842

Please sign in to comment.