xargo icon indicating copy to clipboard operation
xargo copied to clipboard

When installing a nightly by date, xargo cannot find cargo

Open nbigaouette opened this issue 8 years ago • 2 comments
trafficstars

I am trying to build Rust for AVR following shepmaster's blog post series (the last being http://jakegoulding.com/blog/2016/05/27/rust-on-an-arduino-uno-part-6/).

I wrote a Dockerfile for reproducibility. In there, I specify the exact nightly version I want:

RUN rustup install nightly-2017-10-22
RUN rustup default nightly-2017-10-22

RUN rustup component add rust-src
RUN cargo +nightly-2017-10-22 install xargo

I then proceed to build avr-llvm and avr-rust. Compilation succeeds, but running xargo on a dummy project fails:

xargo build --target avr-atmega2560 --release
error: toolchain 'avr-toolchain' does not have the binary `cargo`

From there, I got two hints:

  1. The official rust build guide says:

This install does not include Cargo, Rust's package manager, which you may also want to build.

  1. @Restioson suggested on gitter installing cargo using rustup.

I though I already installed cargo, so I tried again, this time omitting the date:

rustup install nightly

and now xargo can build my project! (well, it fails on std, but that was expected; cargo did run).

I guess that xargo is not able to find cargo when a specific nightly date is used.

Is that really the cause of the problem?

nbigaouette avatar Oct 26 '17 00:10 nbigaouette

Glad you found a workaround :smile:

Restioson avatar Oct 26 '17 04:10 Restioson

Xargo just uses the cargo that's in PATH, which in your case would be the rustup shim, so I think what you are seeing here is that when rustup uses a custom toolchain, that has no cargo binary in it, it defaults to using the cargo from the nightly toolchain -- it won't use the cargo from the toolchain nightly-YYYY-MM-DD. I suppose it makes sense to not pick a date: if you had nightly-$DATEA and nightly-$DATEB which one should be used?

japaric avatar Oct 29 '17 20:10 japaric