xargo
xargo copied to clipboard
When installing a nightly by date, xargo cannot find cargo
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:
- The official rust build guide says:
This install does not include Cargo, Rust's package manager, which you may also want to build.
- @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?
Glad you found a workaround :smile:
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?