rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.64k stars 12.49k forks source link

build fails with error[E0463]: can't find crate for `rustc_macros` which `rustc` depends on in rustc_llvm #62447

Open Cogitri opened 5 years ago

Cogitri commented 5 years ago

Hello,

We hit this while compiling rust 1.35.0 -> rust 1.36.0 on x86. This is for the distro package for Alpine Linux. Please note that we're compiling against our own triplets, in this case it's for i586-alpine-linux-musl, see the definition here: https://gist.github.com/6bae5fdcf6bb5a95b3b779ceb2dd79f7

I'm pretty sure that that error is on us - but the error message doesn't really help me solve it, so maybe x.py/configure should catch this and give a better error message? A pointer in the right direction would certainly be very appreciated :)

See https://cloud.drone.io/alpinelinux/aports/8259/1/1

Thanks

mati865 commented 5 years ago

Errors like this often happen when rustbuild decides the target does not support dylibs (defaults to static crt).

From the x86 build log:

configure: target.x86_64-unknown-linux-musl.musl-root := /usr

Try changing it to match the target, in this case: i586-alpine-linux-musl

If that doesn't work you can try with RUSTFLAGS="-C target-feature=-crt-static". If that works then something went horribly wrong.

Cogitri commented 5 years ago

Errors like this often happen when rustbuild decides the target does not support dylibs (defaults to static crt).

Hm, thought that too, but our triplets already disable crt-static by default: https://github.com/alpinelinux/aports/blob/d314157469eb1d0278f99d561e7ffcca22c92aa5/community/rust/alpine-target.patch#L45 :thinking:

Try changing it to match the target, in this case: i586-alpine-linux-musl

Oh, didn't notice that, will try, thanks.

Cogitri commented 5 years ago

Seems like neither of those things helped: https://cloud.drone.io/alpinelinux/aports/8847/4/1

Here's the build recipe: https://github.com/alpinelinux/aports/pull/9353/files

mati865 commented 5 years ago

Sorry but I have no idea. It fails in stage0 so maybe host compiler is not working properly. Does x86_64 work?

Cogitri commented 5 years ago

Yup, x86_64 has been working for some releases now :/

Cogitri commented 5 years ago

Hm, I changed the triplets to be closer to the upstream ones (https://github.com/alpinelinux/aports/pull/9353/files#diff-ccfaa4435cf05bd784144a7d7720c82cR39) but it still doesn't work, so I guess it's not on the triplets: https://gist.github.com/1dfdf04db4e88950a8db2840b3ce97d1

I'm a bit confused because it does build rustc_macros earlier in the build but then can't find it :/

Just to make sure that it's not on one of our patches, I just built rustc again without any of our patches (other than for the alpine triplets) and it's still bad.

Cogitri commented 5 years ago

Hm, the same compiler works fine for the upstream triplets, I'm honestly unsure what's going wrong here

Cogitri commented 5 years ago

Huh, it even fails with this triplet:

$cat aarch64_alpine_linux_musl.rs 

use crate::spec::TargetResult;

pub fn target() -> TargetResult {
    let base = super::aarch64_unknown_linux_musl::target()?;

    Ok(base)
}
workingjubilee commented 1 year ago

Hm. Is this still a problem?

lrvick commented 9 months ago

@workingjubilee I -think- I am running into the same or a similar problem in my efforts to bootstrap 1.54 here:

https://github.com/thepowersgang/mrustc/issues/324#issuecomment-1847622231