discovery icon indicating copy to clipboard operation
discovery copied to clipboard

probe-rs-tools installation fails

Open dyozie opened this issue 1 year ago • 8 comments

In Ubuntu, installing probe-rs-tools with cargo as indicated at https://github.com/rust-embedded/discovery/blob/71004431ef2ec0663f137a7a6262f8e5e1be458d/microbit/src/03-setup/README.md?plain=1#L72 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.

dyozie avatar Aug 12 '24 23:08 dyozie

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?

BartMassey avatar Aug 13 '24 01:08 BartMassey

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

BartMassey avatar Aug 13 '24 02:08 BartMassey

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.

BartMassey avatar Aug 13 '24 18:08 BartMassey

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.

dyozie avatar Aug 13 '24 20:08 dyozie

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.

BartMassey avatar Aug 13 '24 21:08 BartMassey

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.

spyoungtech avatar Aug 30 '24 07:08 spyoungtech

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.

spyoungtech avatar Aug 30 '24 08:08 spyoungtech

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)

jannic avatar Aug 30 '24 08:08 jannic

Image

I got this error when I ran cargo install probe-rs-tools

msilveus avatar Jul 06 '25 21:07 msilveus

I got this error when I ran cargo install probe-rs-tools

Sigh. This is almost certainly a false positive from Norton AV.

There is very little we can do about this. You can try filing an issue against probe-rs.

If you clone the repo do you get the same error when running cargo install -path .? This would make it more likely that the probe-rs folks would be interested.

For now, I suggest installing binaries as described on the probe-rs website and seeing if Norton will take that.

BartMassey avatar Jul 07 '25 02:07 BartMassey

We will shortly archive this version of the Discovery Book in favor of the newer discovery-mb2 for the Microbit V2. This PR discovery-mb2/#31 will be merged there shortly and provides more modern instruction on how to install probe-rs-tools. Once it is merged, I will close this issue: please see Discovery MB2 if you are experiencing probe-rs-tools installation issues.

BartMassey avatar Jul 07 '25 19:07 BartMassey