1

I'm trying to set up Bevy 0.7.0 for the first time on Ubuntu 20.04, following the official guide on their website, and as soon as I configured it for fast compiles, it stopped compiling altogether. At first, it didn't find the clang linker, even though I had installed lld as instructed, but I solved that by installing the entire clang package. Then, after switching to the nightly channel, cargo run gave me this output:

   Compiling bevy-crevice-derive v0.7.0
error: Metal API enabled on non-Apple OS. If your project is not using resolver="2" in Cargo.toml, it should.
  --> /home/lenerdv/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.12.5/src/lib.rs:51:1
   |
51 | compile_error!("Metal API enabled on non-Apple OS. If your project is not using resolver=\"2\" in Cargo.toml, it should.");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: DX12 API enabled on non-Windows OS. If your project is not using resolver="2" in Cargo.toml, it should.
  --> /home/lenerdv/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.12.5/src/lib.rs:53:1
   |
53 | compile_error!("DX12 API enabled on non-Windows OS. If your project is not using resolver=\"2\" in Cargo.toml, it should.");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

followed by a bunch of cannot find ___ and undeclared crate ___ type errors (hundreds of them), and a final type annotations needed error (full output). It's mainly complaining about mtl, so I'm guessing it might be a missing dependency, but I'm not sure as I'm quite new to rust.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366

1 Answers1

1

mtl stands for "Metal" which is an Apple API. So your problem isn't a missing dependency but a wrong configuration. This should be fixed by adding resolver="2" in your Cargo.toml as per the compiler suggestion.

For more details, see: https://doc.rust-lang.org/cargo/reference/features.html#feature-resolver-version-2

Jmb
  • 18,893
  • 2
  • 28
  • 55