简体   繁体   中英

rust-embedded Discovery `05-led-roulette` fails to build

Background

I am following this guide to build the projects in the corresponding repo . I successfully compiled, ran and verified project 03 .

Problem

However, following the instructions to build project 05 produces "error[E0463]: can't find crate for core ":

$ cargo build --features v2 --target thumbv7em-none-eabihf
info: syncing channel updates for 'nightly-2021-08-18-aarch64-apple-darwin'
info: latest update on 2021-08-18, rust version 1.56.0-nightly (30a0a9b69 2021-08-17)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-src'
info: downloading component 'rust-std'
info: downloading component 'rust-std' for 'riscv32imac-unknown-none-elf'
info: downloading component 'rust-std' for 'riscv32imc-unknown-none-elf'
info: downloading component 'rust-std' for 'thumbv6m-none-eabi'
info: downloading component 'rust-std' for 'thumbv7em-none-eabi'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-src'
info: installing component 'rust-std'
info: installing component 'rust-std' for 'riscv32imac-unknown-none-elf'
info: installing component 'rust-std' for 'riscv32imc-unknown-none-elf'
info: installing component 'rust-std' for 'thumbv6m-none-eabi'
info: installing component 'rust-std' for 'thumbv7em-none-eabi'
info: installing component 'rustc'
info: installing component 'rustfmt'
info: syncing channel updates for 'stable-aarch64-apple-darwin'
info: latest update on 2022-01-20, rust version 1.58.1 (db9d1b20b 2022-01-20)
info: downloading component 'rust-src'
info: installing component 'rust-src'
   Compiling critical-section v0.2.5
error[E0463]: can't find crate for `core`
  |
  = note: the `thumbv7em-none-eabihf` target may not be installed
  = help: consider downloading the target with `rustup target add thumbv7em-none-eabihf`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

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

This seems like an unexpected error, since it suggests that I'm missing the thumbv7em-none-eabihf target toolchain, and yet project 03 would not have compiled correctly without this toolchain installed.

Question

Can I fix something about my system to correctly build project 05? Or is there a bug in the project?

Related system data:

If anyone would like more information, please lmk in the comments and I can update this section with more outputs from my machine.

$ rustup component list --installed
cargo-aarch64-apple-darwin
clippy-aarch64-apple-darwin
rust-src
rust-std-aarch64-apple-darwin
rust-std-thumbv7em-none-eabihf
rustc-aarch64-apple-darwin
rustfmt-aarch64-apple-darwin

$ rustup show
Default host: aarch64-apple-darwin
rustup home:  /Users/___/.rustup

installed toolchains
--------------------

stable-aarch64-apple-darwin (default)
nightly-2021-08-18-aarch64-apple-darwin

installed targets for active toolchain
--------------------------------------

aarch64-apple-darwin
thumbv7em-none-eabihf

active toolchain
----------------

stable-aarch64-apple-darwin (default)
rustc 1.58.1 (db9d1b20b 2022-01-20)

Turns out my rust toolchain was broken; I originally installed everything with nix, but replacing some of the nix installs with rustup installs (ie, cargo) fixed the issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM