Auto merge of #138784 - madsmtm:bootstrap-bump-cc-cmake, r=jieyouxu

Bump boostrap `cc` to 1.2.17 and `cmake` to 0.1.54

The `cc` version in `bootstrap` was reverted down to 1.1.22 in https://github.com/rust-lang/rust/pull/137460 (previously at 1.2.0). The offending issue has since then been resolved in https://github.com/rust-lang/cc-rs/pull/1413, and a new version of `cc` has been released in https://github.com/rust-lang/cc-rs/pull/1435, so let's try to update the version again.

See [the `cc-rs` changelog](d9dd20e376/CHANGELOG.md) and [the `cmake-rs` changelog](fd56c5a6b4/CHANGELOG.md) for details on what has changed here.

r? jieyouxu who tried this last in https://github.com/rust-lang/rust/pull/137022.
`@rustbot` label T-bootstrap
try-job: *apple*
This commit is contained in:
bors 2025-03-29 00:03:11 +00:00
commit 2848101ed5
4 changed files with 44 additions and 13 deletions

View File

@ -88,9 +88,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.1.22"
version = "1.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0"
checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a"
dependencies = [
"shlex",
]
@ -150,9 +150,9 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
[[package]]
name = "cmake"
version = "0.1.48"
version = "0.1.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"
dependencies = [
"cc",
]

View File

@ -32,10 +32,8 @@ test = false
# Most of the time updating these dependencies requires modifications to the
# bootstrap codebase(e.g., https://github.com/rust-lang/rust/issues/124565);
# otherwise, some targets will fail. That's why these dependencies are explicitly pinned.
#
# Do not upgrade this crate unless https://github.com/rust-lang/cc-rs/issues/1317 is fixed.
cc = "=1.1.22"
cmake = "=0.1.48"
cc = "=1.2.17"
cmake = "=0.1.54"
build_helper = { path = "../build_helper" }
clap = { version = "4.4", default-features = false, features = ["std", "usage", "help", "derive", "error-context"] }

View File

@ -1,4 +1,4 @@
Change this file to make users of the `download-ci-llvm` configuration download
a new version of LLVM from CI, even if the LLVM submodule hasnt changed.
Last change is for: https://github.com/rust-lang/rust/pull/134740
Last change is for: https://github.com/rust-lang/rust/pull/138784

View File

@ -385,9 +385,6 @@ impl Step for Llvm {
|| target.contains("apple-watchos")
|| target.contains("apple-visionos")
{
// These two defines prevent CMake from automatically trying to add a MacOSX sysroot, which leads to a compiler error.
cfg.define("CMAKE_OSX_SYSROOT", "/");
cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", "");
// Prevent cmake from adding -bundle to CFLAGS automatically, which leads to a compiler error because "-bitcode_bundle" also gets added.
cfg.define("LLVM_ENABLE_PLUGINS", "OFF");
// Zlib fails to link properly, leading to a compiler error.
@ -645,10 +642,17 @@ fn configure_cmake(
if !builder.is_builder_target(target) {
cfg.define("CMAKE_CROSSCOMPILING", "True");
// NOTE: Ideally, we wouldn't have to do this, and `cmake-rs` would just handle it for us.
// But it currently determines this based on the `CARGO_CFG_TARGET_OS` environment variable,
// which isn't set when compiling outside `build.rs` (like bootstrap is).
//
// So for now, we define `CMAKE_SYSTEM_NAME` ourselves, to panicking in `cmake-rs`.
if target.contains("netbsd") {
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
} else if target.contains("dragonfly") {
cfg.define("CMAKE_SYSTEM_NAME", "DragonFly");
} else if target.contains("openbsd") {
cfg.define("CMAKE_SYSTEM_NAME", "OpenBSD");
} else if target.contains("freebsd") {
cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
} else if target.is_windows() {
@ -659,10 +663,27 @@ fn configure_cmake(
cfg.define("CMAKE_SYSTEM_NAME", "SunOS");
} else if target.contains("linux") {
cfg.define("CMAKE_SYSTEM_NAME", "Linux");
} else if target.contains("darwin") {
// macOS
cfg.define("CMAKE_SYSTEM_NAME", "Darwin");
} else if target.contains("ios") {
cfg.define("CMAKE_SYSTEM_NAME", "iOS");
} else if target.contains("tvos") {
cfg.define("CMAKE_SYSTEM_NAME", "tvOS");
} else if target.contains("visionos") {
cfg.define("CMAKE_SYSTEM_NAME", "visionOS");
} else if target.contains("watchos") {
cfg.define("CMAKE_SYSTEM_NAME", "watchOS");
} else if target.contains("none") {
// "none" should be the last branch
cfg.define("CMAKE_SYSTEM_NAME", "Generic");
} else {
builder.info(&format!(
"could not determine CMAKE_SYSTEM_NAME from the target `{target}`, build may fail",
));
// Fallback, set `CMAKE_SYSTEM_NAME` anyhow to avoid the logic `cmake-rs` tries, and
// to avoid CMAKE_SYSTEM_NAME being inferred from the host.
cfg.define("CMAKE_SYSTEM_NAME", "Generic");
}
// When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in
@ -672,7 +693,19 @@ fn configure_cmake(
// CMakeFiles (and then only in tests), and so far no issues have been
// reported, the system version is currently left unset.
if target.contains("darwin") {
if target.contains("apple") {
if !target.contains("darwin") {
// FIXME(madsmtm): compiler-rt's CMake setup is kinda weird, it seems like they do
// version testing etc. for macOS (i.e. Darwin), even while building for iOS?
//
// So for now we set it to "Darwin" on all Apple platforms.
cfg.define("CMAKE_SYSTEM_NAME", "Darwin");
// These two defines prevent CMake from automatically trying to add a MacOSX sysroot, which leads to a compiler error.
cfg.define("CMAKE_OSX_SYSROOT", "/");
cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", "");
}
// Make sure that CMake does not build universal binaries on macOS.
// Explicitly specify the one single target architecture.
if target.starts_with("aarch64") {