rust-lang / cfg-if

A if/elif-like macro for Rust #[cfg] statements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failed build release aarch64-apple-ios

DAOCUONG opened this issue · comments

error[E0463]: can't find crate for core
|
= note: the aarch64-apple-ios target may not be installed

error: aborting due to previous error

For more information about this error, try rustc --explain E0463.
error: could not compile cfg-if

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for core
|
= note: the aarch64-apple-ios target may not be installed

error: aborting due to previous error

For more information about this error, try rustc --explain E0463.
error: build failed
[ERROR cargo_lipo] Failed to build "rust_sdk" for "aarch64-apple-ios": Executing "/Users/xxxx/.rustup/toolchains/nightly-x86_64-apple-darwin/bin/cargo" "--color" "auto" "build" "-p" "rust_sdk" "--target" "aarch64-apple-ios" "--release" "--lib" finished with error status: exit code: 101

Are you using GitHub Actions by any chance?

No im not i just want to build release build for ios target aarch64-apple-ios Command: cargo lipo --release

I have the same trouble in github actions with target x86_64-unknown-linux-musl (the very same CI was working fine 28 days ago):

Compiling cfg-if v1.0.0
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-unknown-linux-musl` target may not be installed


   Compiling libc v0.2.93
error: aborting due to previous error


error: could not compile `cfg-if`

We were running into a similar issue but ours was related to maturin so I'm not sure if this will help: PyO3/maturin#478

Thank you very much @rajivshah3, it does help a lot. I am also using maturin, so in my case it's the same maturin related bug.

Oh, great! We've pinned maturin to 0.9.4 for the time being until the PR to fix that issue is merged

I’m trying to build youki on Alpine Linux with Rust and Cargo installed from the Alpine packages (x86_64-alpine-linux-musl) and it seems that I’ve encountered the same problem:

error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-unknown-linux-gnu` target may not be installed

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to previous error

What the heck is this?! Someone has again created some stupid assumption that there’s only limited set of triplets?

Half a year has passed, there’s the first stable release of youki and I ran into this crap again and it’s still not fixed.

This is not due to this crate, and I haven't been proactive enough about closing this, so I will do so now. @jirutka I'll ask you to tone down your behavior as well.

You’re right that it’s not due to this crate, I finally found the cause – the youki author committed .cargo/config with build.target into the repository. I’ve packaged dozens of Rust projects, but never encountered this kind of problem (.cargo/config in the source repository/tarball).

Let me show you full build log:

$ cargo build --release -j1
   Compiling libc v0.2.112
   Compiling proc-macro2 v1.0.34
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.83
   Compiling autocfg v1.0.1
   Compiling cfg-if v1.0.0
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-unknown-linux-gnu`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to previous error

It looks like it did compile several crates and failed on cfg-if. Yes, If I had tried to build it with --verbose and read the output properly, I would have seen --target in the rustc options and got a clue that the problem is elsewhere.

   Compiling cfg-if v1.0.0
     Running `rustc --crate-name cfg_if --edition=2018 ~/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto -C metadata=46512ee2004c7e0d -C extra-filename=-46512ee2004c7e0d --out-dir target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=target/x86_64-unknown-linux-gnu/release/deps -L dependency=target/release/deps --cap-lints allow`

It’s my fault that I didn’t, but 1. the error message is really very misleading, 2. I already encountered crates that stupidly assume a fixed set of build triplets, 3. I found this unresolved issue describing the same error, 4. it wouldn’t be the first time I’ve been bitten by your assumptions. So I was a bit annoyed and had no reason to look for another cause.

So I’m sorry for my tone, but I hope you will understand it now.

@alexcrichton thanks you for the work, really appreciate your work.