rooch-network / rooch

VApp Container with Move Language
https://rooch.network
Apache License 2.0
128 stars 54 forks source link

[Build] using asdf rust plugin to build rust toolchain results in incompatible errors. #1554

Closed feliciss closed 1 month ago

feliciss commented 1 month ago

Build process:

cargo build && cp target/debug/rooch ~/.cargo/bin/
info: syncing channel updates for '1.74.0-aarch64-apple-darwin'
info: latest update on 2023-11-16, rust version 1.74.0 (79e9716c9 2023-11-13)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
error: the 'cargo' binary, normally provided by the 'cargo' component, is not applicable to the '1.74.0-aarch64-apple-darwin' toolchain

I'm using asdf-rust plugin to manage rust versions and install pkgs.

The output shows there's no 1.74.0-aarch64-apple-darwin for the cargo binary in the toolchain, whereas in the toolchain file:

1.74.0

The error occurs because its syntax is incorrect.

The rust-toolchain file is a TOML file format consisting of a format like below:

[toolchain]
channel = "nightly-2020-07-10"
components = [ "rustfmt", "rustc-dev" ]
targets = [ "wasm32-unknown-unknown", "thumbv2-none-eabi" ]
profile = "minimal"

The correct way, there should be an indicator and date for the version instead of the version number itself for the whole rust binaries.

Ref:

  1. https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file
  2. https://rust-lang.github.io/rustup/concepts/toolchains.html
  3. https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html