rune icon indicating copy to clipboard operation
rune copied to clipboard

Rune Build error in current Docker Image, cargo fmt not installed

Open kfezer opened this issue 4 years ago • 3 comments

Getting this error when following tutorial on https://hotg.dev/docs/#build-the-rune

:

[2021-06-20T18:26:22.075Z DEBUG rune_codegen::environment] Formatting the generate code
error: 'cargo-fmt' is not installed for the toolchain '1.52.1-x86_64-unknown-linux-gnu'
To install, run `rustup component add rustfmt`
[2021-06-20T18:26:22.594Z WARN  rune_codegen::environment] Unable to format the generated code

  Caused by:
      `cargo fmt` failed with return code: 1
[2021-06-20T18:26:22.594Z DEBUG rune_codegen::environment] Executing "cargo" "+nightly-2021-05-09" "build" "--target=wasm32-unknown-unknown" "--quiet" "--release"





^X^CError: Rune compilation failed

kfezer avatar Jun 20 '21 18:06 kfezer

Hi! Thank you for reporting this bug! @kfezer could you share details on your environment:

  1. OS
  2. Did you use docker? If so what version is your docker?

kthakore avatar Jun 20 '21 20:06 kthakore

I was able to reproduce this bug on my device running macOS Catalina, Docker version 20.10.6 while attempting to build the Runefile. Verbose command and output:

$  docker run -v `pwd`:`pwd` -w `pwd`  -i -t tinyverseml/rune-cli /usr/local/bin/rune build Runefile.yaml
[2021-06-21T00:40:25.998Z DEBUG rune::build] Parsing "Runefile.yaml"
[2021-06-21T00:40:26.020Z DEBUG rune::build] Compiling test in "/root/.cache/runes/test"
[2021-06-21T00:40:26.541Z DEBUG rune_codegen::environment] Read 21151551 bytes from "/Users/milind/GitHub/test/./food.tflite"
[2021-06-21T00:40:26.547Z INFO  rune_codegen::environment] Generating the project in "/root/.cache/runes/test"
[2021-06-21T00:40:26.550Z DEBUG rune_codegen::environment] Making sure the "/root/.cache/runes/test" directory exists
[2021-06-21T00:40:26.551Z DEBUG rune_codegen::environment] Wrote 836 bytes to "/root/.cache/runes/test/Cargo.toml"
[2021-06-21T00:40:26.551Z DEBUG rune_codegen::environment] Making sure the "/root/.cache/runes/test/.cargo" directory exists
[2021-06-21T00:40:26.551Z DEBUG rune_codegen::environment] Wrote 109 bytes to "/root/.cache/runes/test/.cargo/config.toml"
[2021-06-21T00:40:26.580Z DEBUG rune_codegen::environment] Wrote 21151551 bytes to "/root/.cache/run
es/test/food.tflite"
[2021-06-21T00:40:26.581Z DEBUG rune_codegen::environment] Wrote 3599 bytes to "/root/.cache/runes/test/lib.rs"
[2021-06-21T00:40:26.582Z DEBUG rune_codegen::environment] Formatting the generate code
error: 'cargo-fmt' is not installed for the toolchain '1.52.1-x86_64-unknown-linux-gnu'
To install, run `rustup component add rustfmt`
[2021-06-21T00:40:28.123Z WARN  rune_codegen::environment] Unable to format the generated code

  Caused by:
      `cargo fmt` failed with return code: 1
[2021-06-21T00:40:28.128Z DEBUG rune_codegen::environment] Executing "cargo" "+nightly-2021-05-09" "build" "--target=wasm32-unknown-unknown" "--quiet" "--release"
[2021-06-21T00:42:59.294Z DEBUG rune_codegen::environment] Read 21198601 bytes from "/root/.cache/runes/test/target/wasm32-unknown-unknown/release/test.wasm"
[2021-06-21T00:42:59.323Z DEBUG rune::build] Generated 21198601 bytes

@Michael-F-Bryan @kthakore The 'cargo fmt' failed error does not seem to impede building a rune (it just takes quite some time to run the command: ~3 mins on my device). Some ideas:

  • Update the docker container to include the rustfmt crate (This fix should close the issue)
  • Mention in documentation that cargo build step will take some time
  • Update error messages (see issue #161)
  • Addressing the previous point, maybe we can have a progress bar to display the rune build progress?

Mi1ind avatar Jun 21 '21 01:06 Mi1ind

The "cargo-fmt not installed" error message was resolved in #179 so I think we just need to regenerate the docker image.

We format the generated Rust code as a nicety for anyone that may want to read it (primarily us when troubleshooting) so not having cargo-fmt installed doesn't fail the build.

Michael-F-Bryan avatar Jun 21 '21 03:06 Michael-F-Bryan