Coder Social home page Coder Social logo

asdf-rust's Introduction

asdf-rust

Build Status

Rust plugin for asdf version manager.

Install

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

After you have installed rust, do NOT follow the directions it outputs to update your PATH -- asdf's shim will handle that for you!

Use

Check asdf readme for instructions on how to install & manage versions of Rust.

Default cargo crates

asdf-rust can automatically install a default set of packages with cargo right after installing a Rust version. To enable this feature, provide a $HOME/.default-cargo-crates file that lists one package per line, for example:

// cli-tools
ripgrep

// install from source
--git https://github.com/sharkdp/bat

You can specify a non-default location of this file by setting a ASDF_CRATE_DEFAULT_PACKAGES_FILE variable.

ASDF_RUST_PROFILE variable can be used to install different from default profile (e.g. minimal or complete).

asdf-rust's People

Contributors

birdie0 avatar fazibear avatar gabitchov avatar jackmac92 avatar jc00ke avatar khalsah avatar nickveys avatar quintasan avatar quintrino avatar rogusdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asdf-rust's Issues

Shims fail if no arguments are passed

Steps to reproduce

Install rust:

asdf plugin-add rust
asdf install rust stable

Run rust without arguments:

rustc

Expected behavior

It prints out the help messages of rustc.

Actual behavior

/Users/cm022291/.asdf/lib/commands/shim-exec.sh: line 21: shim_args[@]: unbound variable

Environment

OS: macOS 10.14.5
asdf version: v0.7.4, install from git.

P.S. python, ruby, node, yarn installed from asdf all work well without arguments. Cargo exhibits same behavior as rustc

P.P.S. I shamelessly stole this template from asdf-vm/asdf#522

error: no default toolchain configured

Newbie to rust

$ echo "rust 1.37.0" > .tool-versions

$ asdf install
...
Rust is installed now. Great!
...

$ source /Users/brian/.asdf/installs/rust/1.37.0/env

$ rustc
error: no default toolchain configured

Do I need to use rustup after this install?

[Question] How to do rustup upgrades?

This is probably silly, but how do we upgrade rustup with the ASDF plugin? Just rustup update?

I'm just asking because I have no idea if that would mess up something else installed initially by ASDF, or any references needed to uninstall, etc.

ASDF_CRATE_DEFAULT_PACKAGES_FILE not consistent with other asdf plugins

First, ty for this plugin.

Looking at some of the other language plugins (python, nodejs), they provide env variables similar to ASDF_CRATE_DEFAULT_PACKAGES_FILE:

In each case, the env variable overrides the entire pathname, including the basename. You just reset the location. It's your script and you define the environment variable as you please. But it's not consistent with other plugin usage.

You might also want to mention that after asdf install rust, you should asdf reshim rust and rustup default stable. Probably need to do a reshim after cargo install as well. The reshim stuff can be a little confusing.

No default toolchain installed after finished?

So this is a weird one and might be user error -- after installing rust seemingly successfully, it still tells me I have no default toolchain:

VERSION_RUST=1.42.0

$ asdf install rust $VERSION_RUST
info: downloading installer
info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for '1.42.0-x86_64-unknown-linux-gnu'
info: latest update on 2020-03-12, rust version 1.42.0 (b8cedc004 2020-03-09)
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'
 12.0 MiB /  12.0 MiB (100 %)   2.1 MiB/s in  5s ETA:  0s
info: installing component 'rust-std'
info: installing component 'rustc'
 58.6 MiB /  58.6 MiB (100 %)  15.3 MiB/s in  3s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to '1.42.0'

  1.42.0 installed - rustc 1.42.0 (b8cedc004 2020-03-09)


Rust is installed now. Great!

To get started you need Cargo's bin directory
(/home/chris/.asdf/installs/rust/1.42.0/bin) in your PATH
environment variable.

To configure your current shell run
source /home/chris/.asdf/installs/rust/1.42.0/env

Looks like it worked, right?

But then:

$ asdf global rust $VERSION_RUST
$ rustc --version
error: no default toolchain configured
$ rustup toolchain list
no installed toolchains

So I try reshim, just in case, but no luck:

$ asdf reshim rust
$ rustup toolchain list
no installed toolchains

.bashrc adds to PATH by including rust env:

source $HOME/.asdf/asdf.sh && source $HOME/.asdf/completions/asdf.bash
source $HOME/.asdf/installs/rust/1.42.0/env

confirmed in PATH:

$ echo $PATH
/home/chris/.asdf/installs/rust/1.42.0/bin:/home/chris/.asdf/shims:/home/chris/.asdf/bin:/usr/local/sbin: ...

Am I missing something? This is inside WSL, tho that should not matter.

...
Digging deeper I do see that there is a toolchain adjacent to the dir that is on my PATH:

~/.asdf/installs/rust/1.42.0/toolchains$ ls
1.42.0-x86_64-unknown-linux-gnu

So how come that is not set as the default toolchain, despite the installation that should be setting it? And what do I need to configure to point rust to point to this dir for what it should be looking for?

Rpi4 error: no override and no default toolchain set

On Raspberry PI4 with Raspbian i get
error: no override and no default toolchain set
no matter what rust version installed

I got asdf installed system wide on /opt/asdf
with
ASDF_DATA_DIR=/opt/asdf
ASDF_DIR=/opt/asdf
and
rust 1.46.0
on .tool-versions

what can i do more to run rust?

Support for nightly?

Some projects (like Rockets) suggest using nightly. rustup supports this nicely, was wondering if you had interest in supporting it here?

Use symlink for stable

atm stable is 1.30.1 .

It would be nice if stable built the current stable version, and then created 'stable' as a symlink or similar.

This might also be something that asdf itself might be enhanced to support.

Wrong version got installed for latest

I used asdf update to install the latest version of rust and it got shown in asdf as 1.63. When calling cargo/rustc, these commands reported version 1.56. I did a asdf uninstall rust and reinstalled, leading to this session:

[20:16:25] λ  asdf install rust latest
info: downloading installer
warning: it looks like you have an existing installation of Rust at:
warning: /home/jan/.asdf/shims
warning: rustup should not be installed alongside Rust. Please uninstall your existing Rust first.
warning: Otherwise you may have confusion unless you are careful with your PATH
warning: If you are sure that you want both rustup and your already installed Rust
warning: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes
warning: or pass `-y' to ignore all ignorable checks.
error: cannot install while Rust is installed
warning: continuing (because the -y flag is set and the error is ignorable)
info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for '1.63.0-x86_64-unknown-linux-gnu'
info: latest update on 2022-08-11, rust version 1.63.0 (4b91a6ea7 2022-08-08)
info: downloading component 'cargo'
...
info: default toolchain set to '1.63.0-x86_64-unknown-linux-gnu'

  1.63.0-x86_64-unknown-linux-gnu installed - rustc 1.63.0 (4b91a6ea7 2022-08-08)


Rust is installed now. Great!

To get started you need Cargo's bin directory
(/home/jan/.asdf/installs/rust/1.63.0/bin) in your PATH
environment variable. This has not been done automatically.

To configure your current shell, run:
source "/home/jan/.asdf/installs/rust/1.63.0/env"


[20:17:11] λ  rustc --version
rustc 1.56.1 (59eed8a2a 2021-11-01)

[20:23:22] λ  ~/.asdf/installs/rust/1.63.0/bin/cargo --version
cargo 1.56.0 (4ed5d137b 2021-10-04)

In the end I had to do a rustup update to get the right versions:

[20:23:41] [1] ✗  rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2022-08-11, rust version 1.63.0 (4b91a6ea7 2022-08-08)
...
info: installing component 'rustfmt'
error: rustup is not installed at '/home/jan/.cargo'


[20:24:27] [1] ✗  cargo --version
cargo 1.63.0 (fd9c4297c 2022-07-01)

I've no clue what can influence what rustup is actually installing in the end, but this was surprising to me, I had expected that asdf rust versions are installed completely outside of any config I may locally have.

$HOME/.rustup/settings.toml contains (now, after rustup update!)

default_toolchain = "stable"
profile = "default"
version = "12"

[overrides]

Reshim is needed after installing a binary

After doing something like cargo install bat, I expect bat to be available in my $PATH, but I have to run asdf reshim rust first. Is this something that can be fixed/improved?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.