Unable to `-Zbuild-std` because std depends on `compiler-builtins` without the `no-f16-f128` features
TheBlueMatt opened this issue · 5 comments
When trying to build for macOS from Linux for determinism reasons a recent (last week or three?) update to compiler-builtins appears to have started causing issues. Something like RUSTFLAGS="-C target-cpu=apple-a14 -C link-arg=-isysroot/home/matt/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers -C link-arg=-mmacosx-version-min=10.9 -C link-arg=--target=aarch64-apple-darwin -C link-arg=-mcpu=apple-a14 -C link-arg=-fuse-ld=lld -C link-arg=-mcpu=apple-a14" cargo build --features=std --offline -v --release --target aarch64-apple-darwin -Zbuild-std=std,panic_abort now fails with
error[E0412]: cannot find type `f16` in this scope
--> registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.112/src/float/extend.rs:91:40
|
91 | pub extern "C" fn __extendhfsf2(a: f16) -> f32 {
| ^^^ help: a builtin type with a similar name exists: `i16`
.....
error[E0635]: unknown feature `f16`
--> registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.112/src/lib.rs:16:51
|
16 | #![cfg_attr(not(feature = "no-f16-f128"), feature(f16))]
Which nightly version are you using?
This is not on nightly, but rather using RUSTC_BOOTSTRAP=1
compiler-builtins is only expected to work with the latest nightly version. -Zbuild-std should probably be respecting the lockfile for the standard library, but that is non-trivial to implement as the Cargo.lock in the rust-src component is a direct copy of the Cargo.lock in the root of the rust repo, which also includes all crates of the compiler and thus is outdated as far as cargo is concerned.
Fair enough, I have a hack right now that forces cargo to fetch an old compiler_builtins (and cc), deletes the new ones out of the cargo repository, then builds with --offline that works, but boy its a hack :)
@TheBlueMatt if you have control over the compiler-builtins features, there is a feature no-f16-f128 that you can enable to disable these types. Otherwise, pinning the builtins version or using a more recent compiler should work (I think you need at least the current beta for f16/f128 to work since this makes use of classify() and similar methods, which aren't yet on stable).
I am going to close this since I don't think there is anything to be changed here.