2

Hi I am trying to learn the basics of rust and one of the packages(ron) that comes as dependency for bevy is throwing an error.

When I run cargo build I see:

Compiling ron v0.7.0

Compiling bevy_diagnostic v0.6.0

Compiling bevy_gilrs v0.6.0 Compiling bevy_winit v0.6.0 error:

Unrecognized option: 'json'

error: could not compile ron

warning: build failed, waiting for

other jobs to finish...

error: build failed

To learn more I added --verbose flag, and that gave me rustc command that failed:

/home/tomek/.cargo/bin/rustc --crate-name ron --edition=2018 /home/tomek/.cargo/registry/src/github.com-1ecc6299db9ec823/ron-0.7.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=943a31496299e8f3 -C extra-filename=-943a31496299e8f3 --out-dir /storage/projects/econsim/target/debug/deps -L dependency=/storage/projects/econsim/target/debug/deps --extern base64=/storage/projects/econsim/target/debug/deps/libbase64-532e1d4e3f8b3bca.rmeta --extern bitflags=/storage/projects/econsim/target/debug/deps/libbitflags-c67d8a8593a87f67.rmeta --extern serde=/storage/projects/econsim/target/debug/deps/libserde-42ff4d97cbefd932.rmeta --cap-lints allow

So I put it in command line and this is the output without any error codes:

{"artifact":"/storage/projects/econsim/target/debug/deps/ron-943a31496299e8f3.d","emit":"dep-info"} {"artifact":"/storage/projects/econsim/target/debug/deps/libron-943a31496299e8f3.rmeta","emit":"metadata"} {"artifact":"/storage/projects/econsim/target/debug/deps/libron-943a31496299e8f3.rlib","emit":"link"}

Originally I did not specify path of rustc for cargo to use but either way I got this error. If am not mistaken when cargo calls rustc then --json is no longer a valid option, but when I run rustc in shell its fine? I am not really sure where to proceed from here.

sgp667
  • 1,797
  • 2
  • 20
  • 38
  • What does `cargo --version` and `rustc --version` output? – Aiden4 Jan 16 '22 at 22:55
  • rustc says `rustc 1.58.0 (02072b482 2022-01-11)` and cargo `cargo 1.58.0` – sgp667 Jan 16 '22 at 23:59
  • Is there at least a way that I could make cargo drop that `--json` flag because it seems to me this is more of a formating option rather than something used in the actual compilation process? – sgp667 Jan 17 '22 at 00:09
  • `error-format=json` should probably be interpreted as "error-format is machine-readable", i.e. "Cargo can parse the errors from rustc and show them correctly". – Cerberus Jan 17 '22 at 06:18

1 Answers1

0

I found the issue.

ron was overriding rust-toolchain version, details are here.

To went to location of ron on my hard drive and deleted rust-toolchain file.

sgp667
  • 1,797
  • 2
  • 20
  • 38