asdf-community / asdf-rust

Rust plugin for the asdf version manager
https://github.com/asdf-vm/asdf
Apache License 2.0
97 stars 16 forks source link

asdf which rust throws "unknown command" #1

Closed byteshiva closed 4 years ago

byteshiva commented 4 years ago

Steps to reproduce

~ via ⬢ v12.4.0 via 🐍 v3.8.0 ➜ asdf which rust unknown command: rust. Perhaps you have to reshim? ~ via ⬢ v12.4.0 via 🐍 v3.8.0 ➜ asdf reshim rust ~ via ⬢ v12.4.0 via 🐍 v3.8.0 ➜ asdf which rust unknown command: rust. Perhaps you have to reshim? ~ via ⬢ v12.4.0 via 🐍 v3.8.0 ➜ asdf list rust 1.37.0 1.38.0 1.39.0 ~ via ⬢ v12.4.0 via 🐍 v3.8.0 ➜ cat ~/.tool-versions | grep rust rust 1.39.0 ~ via ⬢ v12.4.0 via 🐍 v3.8.0 ➜

Expected behavior

asdf which rust should return path but its saying "unknown command" Actual behavior

asdf which rust - should return the installation path of RUST Environment

OS: ubuntu 19.10

Linux desktop 5.3.0-23-generic #25-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

asdf version:

➜ asdf --version v0.7.5 ~ via ⬢ v12.4.0 via 🐍 v3.8.0

byteshiva commented 4 years ago

removed current rust plugin location and reinstalled rust using community path. Still its not able to find the rust path.

~ via ⬢ v12.4.0 via 🐍 v3.8.0 
➜ asdf plugin-remove rust 
~ via ⬢ v12.4.0 via 🐍 v3.8.0 
➜ asdf plugin-add rust https://github.com/asdf-community/asdf-rust.git
~ via ⬢ v12.4.0 via 🐍 v3.8.0 took 2s 
~ via ⬢ v12.4.0 via 🐍 v3.8.0 
➜ asdf install rust 1.39.0 
∗ Downloading...
∗ Installing...
install: creating uninstall script at /home/xyz/.asdf/installs/rust/1.39.0/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'cargo'
install: installing component 'rls-preview'
install: installing component 'clippy-preview'
install: installing component 'miri-preview'
install: installing component 'rustfmt-preview'
install: installing component 'llvm-tools-preview'
install: installing component 'rust-analysis-x86_64-unknown-linux-gnu'
install: installing component 'rust-std-x86_64-unknown-linux-gnu'
install: installing component 'rust-docs'
install: WARNING: failed to run ldconfig. this may happen when not installing as root. run with --verbose to see the error

    Rust is ready to roll.

The installation was successful!
~ via ⬢ v12.4.0 via 🐍 v3.8.0 took 3m19s 
➜ asdf global rust 1.39.0
~ via ⬢ v12.4.0 via 🐍 v3.8.0 
➜ asdf reshim rust
~ via ⬢ v12.4.0 via 🐍 v3.8.0 
➜ asdf which rust
unknown command: rust. Perhaps you have to reshim?
~ via ⬢ v12.4.0 via 🐍 v3.8.0 
➜ asdf reshim rust
~ via ⬢ v12.4.0 via 🐍 v3.8.0 
➜ asdf which rust
unknown command: rust. Perhaps you have to reshim?
~ via ⬢ v12.4.0 via 🐍 v3.8.0 
➜ 
smorimoto commented 4 years ago

Try this.

asdf which rustc
smorimoto commented 4 years ago

An error occurs because the binary named rust is not installed.

Screen Shot 2019-11-14 at 20 13 51
byteshiva commented 4 years ago

An error occurs because the binary named rust is not installed.

Screen Shot 2019-11-14 at 20 13 51

Thanks @imbsky it maybe little misleading, as asdf follows the name to query the path of installation. an convenience method can be introduced by maintaining an alias for rust -> rustc.

Also another question I'm unable to run rust rls on vscode. Does it need any configuration that you may know.

Could you let me know the rust.sysroot path, is it same as asdf which rustc

smorimoto commented 4 years ago

What extension do you use? Have you already tried this? This is the official extension. https://marketplace.visualstudio.com/items?itemName=rust-lang.rust

byteshiva commented 4 years ago

I'm using the one you have mentioned , what I'm talking about is rust language server rls, https://github.com/rust-lang/rls-vscode

I'm having issue running rls on vscode, I presume, somehow it's not able to find the rust binary path.

smorimoto commented 4 years ago

Doesn't this work? I haven't tried it, but I'm sure it will work.


{
  "rust-client.rlsPath": "~/.asdf/shims/rls"
}
byteshiva commented 4 years ago

Doesn't this work? I haven't tried it, but I'm sure it will work.

{
  "rust-client.rlsPath": "~/.asdf/shims/rls"
}

It didn't work! Maybe it needs rust BINPATH set in vs code.

[Error - 3:21:51 pm] Starting client failed
Error: Command failed: rustup toolchain list
/bin/sh: rustup: command not found

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:200:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:200:13)
    at Pipe.<anonymous> (net.js:586:12)
smorimoto commented 4 years ago

/bin/sh: rustup: command not found

Maybe that extension requires rustup. This plugin isn't wrap rustup, and another plugin is wrap rustup. Please try another plugin.

smorimoto commented 4 years ago

https://github.com/code-lever/asdf-rust

byteshiva commented 4 years ago

https://github.com/code-lever/asdf-rust

In this case I'd need to remove community asdf-rust right and add asdf plugin-add rust https://github.com/code-lever/asdf-rust.git

smorimoto commented 4 years ago

This should work.

asdf plugin-remove rust
asdf plugin-add rust https://github.com/code-lever/asdf-rust.git