Open
Description
Hi!
I've been trying to install the avr-rust
toolchain to build the blink project, and because I try to keep the things reproducible, I'm doing it in a Docker image.
FROM alpine AS cache
RUN apk add --no-cache git curl
RUN curl -o /rust-std-beta-x86_64-unknown-linux-gnu.tar.gz https://static.rust-lang.org/dist/2019-05-23/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz
RUN curl -o /rustc-beta-x86_64-unknown-linux-gnu.tar.gz https://static.rust-lang.org/dist/2019-05-23/rustc-beta-x86_64-unknown-linux-gnu.tar.gz
RUN curl -o /cargo-beta-x86_64-unknown-linux-gnu.tar.gz https://static.rust-lang.org/dist/2019-05-23/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
RUN git clone https://github.com/avr-rust/rust.git --recursive /avr-rust \
&& rm -rf /avr-rust/.git
FROM rust:1-slim-stretch
RUN apt-get update \
&& apt-get install -y build-essential cmake curl python \
&& rm -rf /var/lib/apt/lists/*
ENV AVR_RUST_SRC_PATH /work/avr-rust
ENV AVR_RUST_BUILD_PATH /work/avr-rust-build
COPY --from=cache /avr-rust $AVR_RUST_SRC_PATH
WORKDIR $AVR_RUST_BUILD_PATH
# Generate Makefile using settings suitable for an experimental compiler
RUN $AVR_RUST_SRC_PATH/configure \
--enable-debug \
--disable-docs \
--enable-llvm-assertions \
--enable-debug-assertions \
--enable-optimize \
--enable-llvm-release-debuginfo \
--experimental-targets=AVR \
--prefix=/opt/avr-rust
COPY --from=cache /rust-std-beta-x86_64-unknown-linux-gnu.tar.gz $AVR_RUST_BUILD_PATH/build/cache/2019-05-23/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz
COPY --from=cache /rustc-beta-x86_64-unknown-linux-gnu.tar.gz $AVR_RUST_BUILD_PATH/build/cache/2019-05-23/rustc-beta-x86_64-unknown-linux-gnu.tar.gz
COPY --from=cache /cargo-beta-x86_64-unknown-linux-gnu.tar.gz $AVR_RUST_BUILD_PATH/build/cache/2019-05-23/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
# Build the compiler, optionally install it to /opt/avr-rust
RUN make
RUN mkdir -p /opt/avr-rust && make install
# Register the toolchain with rustup
RUN rustup toolchain link avr-toolchain $(realpath $(find . -name 'stage2'))
# Optionally enable the avr toolchain globally
# RUN rustup default avr-toolchain
RUN cargo install xargo
RUN cp $(find /usr/local/rustup/toolchains -name cargo | grep bin | head -n 1)* /usr/local/rustup/toolchains/avr-toolchain/bin/
It's mostly copy-pasting your documentation, but when I run docker run -e RUST_TARGET_PATH=/code -e XARGO_RUST_SRC=/work/avr-rust/src -v /path/to/blink:/code -w /code avr-rust rustup run avr-toolchain xargo build --target avr-atmega328p --release
I get the following error
warning: Patch `rustc-std-workspace-alloc v1.0.0 (/work/avr-rust/src/tools/rustc-std-workspace-alloc)` was not used in the crate graph.
Patch `rustc-std-workspace-core v1.0.0 (/work/avr-rust/src/tools/rustc-std-workspace-core)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
Compiling core v0.0.0 (/work/avr-rust/src/libcore)
error: Unrecognized option: 'json'
error: could not compile `core`.
To learn more, run the command again with --verbose.
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.GHevOdzy8xrC/Cargo.toml" "--target" "avr-atmega328p" "-p" "core"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace
make: *** [Makefile:7: build] Error 1
I've tried to look around for a solution and nothing came up, except an incompatibility of some components...
Do you guys have a way to fix that?
Metadata
Metadata
Assignees
Labels
No labels