Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5b00e15

Browse files
committedMar 25, 2025
Auto merge of #138784 - madsmtm:bootstrap-bump-cc-cmake, r=<try>
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 #137460 (previously at 1.2.0). The offending issue has since then been resolved in rust-lang/cc-rs#1413, and a new version of `cc` has been released in rust-lang/cc-rs#1435, so let's try to update the version again. See [the `cc-rs` changelog](https://github.com/rust-lang/cc-rs/blob/d9dd20e376368c7535f6ef89b809098f5f203c1a/CHANGELOG.md) and [the `cmake-rs` changelog](https://github.com/rust-lang/cmake-rs/blob/fd56c5a6b4ecda8815c863eb5b12d7b3f0391197/CHANGELOG.md) for details on what has changed here. r? jieyouxu who tried this last in #137022. `@rustbot` label T-bootstrap try-job: *apple*
2 parents f8c27df + 1f675d3 commit 5b00e15

File tree

3 files changed

+43
-12
lines changed

3 files changed

+43
-12
lines changed
 

‎src/bootstrap/Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ dependencies = [
8888

8989
[[package]]
9090
name = "cc"
91-
version = "1.1.22"
91+
version = "1.2.17"
9292
source = "registry+https://github.com/rust-lang/crates.io-index"
93-
checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0"
93+
checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a"
9494
dependencies = [
9595
"shlex",
9696
]
@@ -150,9 +150,9 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
150150

151151
[[package]]
152152
name = "cmake"
153-
version = "0.1.48"
153+
version = "0.1.54"
154154
source = "registry+https://github.com/rust-lang/crates.io-index"
155-
checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
155+
checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"
156156
dependencies = [
157157
"cc",
158158
]

‎src/bootstrap/Cargo.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ test = false
3232
# Most of the time updating these dependencies requires modifications to the
3333
# bootstrap codebase(e.g., https://github.com/rust-lang/rust/issues/124565);
3434
# otherwise, some targets will fail. That's why these dependencies are explicitly pinned.
35-
#
36-
# Do not upgrade this crate unless https://github.com/rust-lang/cc-rs/issues/1317 is fixed.
37-
cc = "=1.1.22"
38-
cmake = "=0.1.48"
35+
cc = "=1.2.17"
36+
cmake = "=0.1.54"
3937

4038
build_helper = { path = "../build_helper" }
4139
clap = { version = "4.4", default-features = false, features = ["std", "usage", "help", "derive", "error-context"] }

‎src/bootstrap/src/core/build_steps/llvm.rs

+37-4
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,6 @@ impl Step for Llvm {
385385
|| target.contains("apple-watchos")
386386
|| target.contains("apple-visionos")
387387
{
388-
// These two defines prevent CMake from automatically trying to add a MacOSX sysroot, which leads to a compiler error.
389-
cfg.define("CMAKE_OSX_SYSROOT", "/");
390-
cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", "");
391388
// Prevent cmake from adding -bundle to CFLAGS automatically, which leads to a compiler error because "-bitcode_bundle" also gets added.
392389
cfg.define("LLVM_ENABLE_PLUGINS", "OFF");
393390
// Zlib fails to link properly, leading to a compiler error.
@@ -645,10 +642,17 @@ fn configure_cmake(
645642
if !builder.is_builder_target(target) {
646643
cfg.define("CMAKE_CROSSCOMPILING", "True");
647644

645+
// NOTE: Ideally, we wouldn't have to do this, and `cmake-rs` would just handle it for us.
646+
// But it currently determines this based on the `CARGO_CFG_TARGET_OS` environment variable,
647+
// which isn't set when compiling outside `build.rs` (like bootstrap is).
648+
//
649+
// So for now, we define `CMAKE_SYSTEM_NAME` ourselves, to panicking in `cmake-rs`.
648650
if target.contains("netbsd") {
649651
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
650652
} else if target.contains("dragonfly") {
651653
cfg.define("CMAKE_SYSTEM_NAME", "DragonFly");
654+
} else if target.contains("openbsd") {
655+
cfg.define("CMAKE_SYSTEM_NAME", "OpenBSD");
652656
} else if target.contains("freebsd") {
653657
cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
654658
} else if target.is_windows() {
@@ -659,10 +663,27 @@ fn configure_cmake(
659663
cfg.define("CMAKE_SYSTEM_NAME", "SunOS");
660664
} else if target.contains("linux") {
661665
cfg.define("CMAKE_SYSTEM_NAME", "Linux");
666+
} else if target.contains("darwin") {
667+
// macOS
668+
cfg.define("CMAKE_SYSTEM_NAME", "Darwin");
669+
} else if target.contains("ios") {
670+
cfg.define("CMAKE_SYSTEM_NAME", "iOS");
671+
} else if target.contains("tvos") {
672+
cfg.define("CMAKE_SYSTEM_NAME", "tvOS");
673+
} else if target.contains("visionos") {
674+
cfg.define("CMAKE_SYSTEM_NAME", "visionOS");
675+
} else if target.contains("watchos") {
676+
cfg.define("CMAKE_SYSTEM_NAME", "watchOS");
677+
} else if target.contains("none") {
678+
// "none" should be the last branch
679+
cfg.define("CMAKE_SYSTEM_NAME", "Generic");
662680
} else {
663681
builder.info(&format!(
664682
"could not determine CMAKE_SYSTEM_NAME from the target `{target}`, build may fail",
665683
));
684+
// Fallback, set `CMAKE_SYSTEM_NAME` anyhow to avoid the logic `cmake-rs` tries, and
685+
// to avoid CMAKE_SYSTEM_NAME being inferred from the host.
686+
cfg.define("CMAKE_SYSTEM_NAME", "Generic");
666687
}
667688

668689
// When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in
@@ -672,7 +693,19 @@ fn configure_cmake(
672693
// CMakeFiles (and then only in tests), and so far no issues have been
673694
// reported, the system version is currently left unset.
674695

675-
if target.contains("darwin") {
696+
if target.contains("apple") {
697+
if !target.contains("darwin") {
698+
// FIXME(madsmtm): compiler-rt's CMake setup is kinda weird, it seems like they do
699+
// version testing etc. for macOS (i.e. Darwin), even while building for iOS?
700+
//
701+
// So for now we set it to "Darwin" on all Apple platforms.
702+
cfg.define("CMAKE_SYSTEM_NAME", "Darwin");
703+
704+
// These two defines prevent CMake from automatically trying to add a MacOSX sysroot, which leads to a compiler error.
705+
cfg.define("CMAKE_OSX_SYSROOT", "/");
706+
cfg.define("CMAKE_OSX_DEPLOYMENT_TARGET", "");
707+
}
708+
676709
// Make sure that CMake does not build universal binaries on macOS.
677710
// Explicitly specify the one single target architecture.
678711
if target.starts_with("aarch64") {

0 commit comments

Comments
 (0)
Failed to load comments.