cmake-rs icon indicating copy to clipboard operation
cmake-rs copied to clipboard

Latest versions break rust-lang bootstrap

Open lasiotus opened this issue 1 year ago • 4 comments

PR https://github.com/rust-lang/rust/pull/134344 that only bumps cc and cmake versions fails due to a cmake error (it seems).

lasiotus avatar Dec 17 '24 16:12 lasiotus

Specifically https://github.com/rust-lang/cmake-rs/commit/d6688089f1e96f5bb0ecdb770b83da4994c4b3ef#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R458

This may be a bootstrap bug, I'll try and look into it

clubby789 avatar Dec 21 '24 10:12 clubby789

Bisection was done at https://github.com/rust-lang/rust/pull/134558.

2024-12-16T08:24:34.9104890Z could not determine CMAKE_SYSTEM_NAME from the target `aarch64-apple-ios`, build may fail
2024-12-16T08:24:34.9107480Z CMAKE_TOOLCHAIN_FILE_aarch64-apple-ios = None
2024-12-16T08:24:34.9109170Z CMAKE_TOOLCHAIN_FILE_aarch64_apple_ios = None
2024-12-16T08:24:34.9111250Z TARGET_CMAKE_TOOLCHAIN_FILE = None
2024-12-16T08:24:34.9116590Z CMAKE_TOOLCHAIN_FILE = None
2024-12-16T08:24:34.9120130Z thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.52/src/lib.rs:1115:5:
2024-12-16T08:24:34.9121100Z 
2024-12-16T08:24:34.9121380Z environment variable `CARGO_CFG_TARGET_OS` not defined
2024-12-16T08:24:34.9121820Z 
2024-12-16T08:24:34.9122030Z build script failed, must exit now

It seems that somehow CARGO_CFG_TARGET_OS isn't available.

jieyouxu avatar Dec 21 '24 10:12 jieyouxu

~~Hm, according to cargo docs, CARGO_CFG_* family of flags are only set for build scripts (by cargo), but https://github.com/rust-lang/cmake-rs/commit/d6688089f1e96f5bb0ecdb770b83da4994c4b3ef#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R458 seemed to unconditionally expect that env var to be available from the environment, but it is not a build script.~~

But cmake-rs is only used from build env, so that shouldn't be a problem...

jieyouxu avatar Dec 21 '24 10:12 jieyouxu

https://github.com/rust-lang/cmake-rs/blob/94da9de2ea79ab6cad572e908864a160cf4847a9/src/lib.rs#L459-L462

These lines expect cmake to be used from a build script, but bootstrap uses it as a runtime library. Feel free to close if this isn't a supported use case - we can fix this from our end by defining the correct CMAKE_SYSTEM_NAME.

clubby789 avatar Dec 21 '24 15:12 clubby789