Auto merge of #137665 - Kobzol:update-sccache, r=marcoieni
Update sccache to 0.10.0 This time, does it also for Windows and macOS. This unifies the sccache version across all OSes that we use. 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 try-job: dist-x86_64-netbsd
This commit is contained in:
commit
9f274ba399
7 changed files with 17 additions and 103 deletions
|
|
@ -28,11 +28,6 @@ name = "rustdoc"
|
|||
path = "src/bin/rustdoc.rs"
|
||||
test = false
|
||||
|
||||
[[bin]]
|
||||
name = "sccache-plus-cl"
|
||||
path = "src/bin/sccache-plus-cl.rs"
|
||||
test = false
|
||||
|
||||
[dependencies]
|
||||
# Most of the time updating these dependencies requires modifications to the
|
||||
# bootstrap codebase(e.g., https://github.com/rust-lang/rust/issues/124565);
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
use std::env;
|
||||
use std::process::{self, Command};
|
||||
|
||||
fn main() {
|
||||
let target = env::var("SCCACHE_TARGET").unwrap();
|
||||
// Locate the actual compiler that we're invoking
|
||||
|
||||
// SAFETY: we're in main, there are no other threads
|
||||
unsafe {
|
||||
env::set_var("CC", env::var_os("SCCACHE_CC").unwrap());
|
||||
env::set_var("CXX", env::var_os("SCCACHE_CXX").unwrap());
|
||||
}
|
||||
|
||||
let mut cfg = cc::Build::new();
|
||||
cfg.cargo_metadata(false)
|
||||
.out_dir("/")
|
||||
.target(&target)
|
||||
.host(&target)
|
||||
.opt_level(0)
|
||||
.warnings(false)
|
||||
.debug(false);
|
||||
let compiler = cfg.get_compiler();
|
||||
|
||||
// Invoke sccache with said compiler
|
||||
let sccache_path = env::var_os("SCCACHE_PATH").unwrap();
|
||||
let mut cmd = Command::new(sccache_path);
|
||||
cmd.arg(compiler.path());
|
||||
for (k, v) in compiler.env() {
|
||||
cmd.env(k, v);
|
||||
}
|
||||
for arg in env::args().skip(1) {
|
||||
cmd.arg(arg);
|
||||
}
|
||||
|
||||
if let Ok(s) = env::var("SCCACHE_EXTRA_ARGS") {
|
||||
for s in s.split_whitespace() {
|
||||
cmd.arg(s);
|
||||
}
|
||||
}
|
||||
|
||||
let status = cmd.status().expect("failed to spawn");
|
||||
process::exit(status.code().unwrap_or(2))
|
||||
}
|
||||
|
|
@ -2378,7 +2378,7 @@ impl Step for Bootstrap {
|
|||
let tarball = Tarball::new(builder, "bootstrap", &target.triple);
|
||||
|
||||
let bootstrap_outdir = &builder.bootstrap_out;
|
||||
for file in &["bootstrap", "rustc", "rustdoc", "sccache-plus-cl"] {
|
||||
for file in &["bootstrap", "rustc", "rustdoc"] {
|
||||
tarball.add_file(bootstrap_outdir.join(exe(file, target)), "bootstrap/bin", 0o755);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -735,57 +735,17 @@ fn configure_cmake(
|
|||
None => (builder.cc(target), builder.cxx(target).unwrap()),
|
||||
};
|
||||
|
||||
// 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");
|
||||
// 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);
|
||||
}
|
||||
} 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
|
||||
|
|
|
|||
|
|
@ -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)"
|
||||
|
|
|
|||
|
|
@ -261,5 +261,5 @@ else
|
|||
fi
|
||||
|
||||
echo "::group::sccache stats"
|
||||
sccache --show-stats || true
|
||||
sccache --show-adv-stats || true
|
||||
echo "::endgroup::"
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@ 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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue