rust-embedded/discovery

probe-rs-tools installation fails

dyozie opened this issue · 8 comments

In Ubuntu, installing probe-rs-tools with cargo as indicated at

$ cargo install probe-rs-tools --vers 0.24.0
fails with an error:

error[E0252]: the name FromBytes is defined multiple times

According to the latest probe-rs release notes, the toolkit should instead be installed via a shell/powershell script. https://github.com/probe-rs/probe-rs/releases has the relevant commands.

Thanks much for bringing this to our attention! That said, I'm not sure how to proceed.

It looks like the method for installing the probe-rs tools has again changed: we are now expected to download release binary tarballs from the probe-rs host and install them with a script. This seems to me not OK to recommend, at least without some clear explanation. The release notes refer me to the homepage or README, but I can't find any information there about this.

Current probe-rs-tools from top-of-tree master on their Git repo builds and installs fine. It looks like commit 6e975baf fixed the issue, but no release to crates.io has been made since then.

Several choices here: guidance appreciated:

  • Make the instructions just refer the user to https://probe.rs for installation instructions. This is probably the safest choice, as I imagine there will be more probe-rs installation issues in the future.

  • Make the instructions pull a known-good commit of probe-rs-tools:

       cargo install --git=https://github.com/probe-rs/probe-rs --rev=aa4e7c09 probe-rs-tools
    

    This would get us a "known-quantity" version of probe-rs, but would miss out on future enhancements

  • Get the probe-rs folks to release 0.24.1 with the bug fixed. We should maybe then do

        cargo install --version='^0.24' probe-rs-tools
    

    so that subsequent minor versions will work, or even give up and

        cargo install probe-rs-tools
    

    and hope.

  • Something else?

Threw a bunch of stuff in the air. We'll see how it falls.

Turns out that cargo install --locked probe-rs-tools resolves the issue. Also turns out that the probe-rs folks don't want people to install using cargo install, for some reason I haven't yet determined.

Thanks @BartMassey - just confirming that installing the locked version works for me on another system. That seems like the quickest/simplest fix for the tutorial. I'm not sure what the tradeoff would be for using the locked build vs the official installer.

The larger problem is that probe-rs apparently released 0.24.0 to crates.io "by mistake" and doesn't plan to release future versions in this way. I too don't understand what tradeoffs prompted this.

That said, I'm glad this worked for you and have a PR to adjust the Book accordingly. Thanks much.

While this issue is open... it is also worth mentioning the guide also neglects to include installing Visual Studio, which is apparently required to compile probe-rs?

Even after installing cmake and putting in on PATH as described in the probe-rs prerequisites guide, I got the following error:

Error
  --- stderr
  CMake Error at CMakeLists.txt:35 (project):
    Generator

      Visual Studio 17 2022

    could not find any instance of Visual Studio.

  thread 'main' panicked at C:\Users\Spencer\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.50\src\lib.rs:1098:5:

Although I have visual studio enterprise 2022 installed, this error persisted until I installed C++ cmake tools via visual studio.

After doing this, I tried installing per the current guide and got the same error[E0252]: the name FromBytes is defined multiple times error described in this issue.

I tried doing the cargo install --locked probe-rs-tools method, but that failed with the following error:

error[E0658]
error[E0658]: use of unstable library feature 'offset_of'                                                                                          
  --> C:\Users\Spencer\.cargo\registry\src\index.crates.io-6f17d22bba15001f\probe-rs-0.24.0\src\rtt\channel.rs:32:9
   |
32 |         std::mem::offset_of!(RttChannelBufferInner<T>, write_offset)
   |         ^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information

error[E0658]: use of unstable library feature 'offset_of'
  --> C:\Users\Spencer\.cargo\registry\src\index.crates.io-6f17d22bba15001f\probe-rs-0.24.0\src\rtt\channel.rs:36:9
   |
36 |         std::mem::offset_of!(RttChannelBufferInner<T>, read_offset)
   |         ^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information

error[E0658]: use of unstable library feature 'offset_of'
  --> C:\Users\Spencer\.cargo\registry\src\index.crates.io-6f17d22bba15001f\probe-rs-0.24.0\src\rtt\channel.rs:40:9
   |
40 |         std::mem::offset_of!(RttChannelBufferInner<T>, flags)
   |         ^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information

For more information about this error, try `rustc --explain E0658`.                                                                                
error: could not compile `probe-rs` (lib) due to 3 previous errors                                                                                 
error: failed to compile `probe-rs-tools v0.24.0`, intermediate artifacts can be found at `C:\Users\Spencer\AppData\Local\Temp\cargo-installaT5YBr`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Circling back around to this, I was able to resolve this by upgrading rust from 1.76.0 to 1.80.1 -- then the --locked install worked.

The guide currently says Rust 1.57.0 or newer should work, but it seems like an even newer version of rust is actually needed to get probe-rs installed now.

It looks like offset_of! was stabilized in 1.77.0: https://releases.rs/docs/1.77.0/
(Usage of that macro was added in probe-rs v0.24.0)