rust-embedded / rust-raspberrypi-OS-tutorials

:books: Learn to write an embedded OS in Rust :crab:
Apache License 2.0
13.64k stars 792 forks source link

Getting started: quick note about "cargo install cargo-binutils" #215

Open DavidAntliff opened 2 months ago

DavidAntliff commented 2 months ago

I'm motivated to post this to help with the "on-boarding".

Instructions say to run:

$ cargo install cargo-binutils rustfilt

Not sure exactly why, but this failed for me with:

error: failed to compile `cargo-binutils v0.3.6`

Caused by:
  package `cargo-platform v0.1.8` cannot be built because it requires rustc 1.73 or newer, while the currently active rustc version is 1.66.0-nightly
  Try re-running cargo install with `--locked`

I happened to have nightly-2022-10-13-x86_64-unknown-linux-gnu installed, which I think corresponds to rustc 1.66.0-nightly (c0983a9aa 2022-10-12), but this isn't my active toolchain normally. It's just installed.

So I re-ran with --locked and it worked:

$ cargo install cargo-binutils rustfilt --locked
...
   Installed package `cargo-binutils v0.3.6` (executables `cargo-cov`, `cargo-nm`, `cargo-objcopy`, `cargo-objdump`, `cargo-profdata`, `cargo-readobj`, `cargo-size`, `cargo-strip`, `rust-ar`, `rust-cov`, `rust-ld`, `rust-lld`, `rust-nm`, `rust-objcopy`, `rust-objdump`, `rust-profdata`, `rust-readobj`, `rust-size`, `rust-strip`)

Assuming that this was the right thing to do, would it make sense to suggest that users always run with --locked, to ensure that the correct versions are picked up?

BartMassey commented 2 months ago

Yeah, we just ran into this in another place as well. I'm going to change everything to suggest --locked. I need to talk to the Cargo folks about why this isn't the default.