Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wgpu-hal causes resolver error #3205

Closed
thechubbypanda opened this issue Nov 27, 2021 · 9 comments
Closed

wgpu-hal causes resolver error #3205

thechubbypanda opened this issue Nov 27, 2021 · 9 comments
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled

Comments

@thechubbypanda
Copy link

Bevy version

main branch, commit: e8412df

Operating system & version

Arch Linux fully up to date

What you did

[dependencies]
bevy = { git = "https://github.com/bevyengine/bevy.git", branch = "main", features = ["dynamic"]}

cargo run

What you expected to happen

Runs correctly

What actually happened

   Compiling wgpu-hal v0.11.4
   Compiling bevy_render v0.5.0 (https://github.com/bevyengine/bevy.git?branch=main#e8412df0)
   Compiling bevy_scene v0.5.0 (https://github.com/bevyengine/bevy.git?branch=main#e8412df0)
   Compiling bevy_audio v0.5.0 (https://github.com/bevyengine/bevy.git?branch=main#e8412df0)
error: Metal API enabled on non-Apple OS. If your project is not using resolver="2" in Cargo.toml, it should.
  --> /home/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.11.4/src/lib.rs:49:1
   |
49 | 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/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.11.4/src/lib.rs:51:1
   |
51 | compile_error!("DX12 API enabled on non-Windows OS. If your project is not using resolver=\"2\" in Cargo.toml, it should.");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `super::dx12`
  --> /home/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.11.4/src/lib.rs:72:20
   |
72 |     pub use super::dx12::Api as Dx12;
   |                    ^^^^ could not find `dx12` in the crate root

error[E0432]: unresolved import `super::metal`
  --> /home/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-hal-0.11.4/src/lib.rs:83:20
   |
83 |     pub use super::metal::Api as Metal;
   |                    ^^^^^ could not find `metal` in the crate root

For more information about this error, try `rustc --explain E0432`.
error: could not compile `wgpu-hal` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

Additional information

I saw #2712 but I'm completely up to date so I don't know what else to do.

@thechubbypanda thechubbypanda added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 27, 2021
@DJMcNab
Copy link
Member

DJMcNab commented Nov 27, 2021

Does the error persist when you add resolver="2" to your package/workspace properties (which is suggested in the error message)?

@thechubbypanda
Copy link
Author

Where am I supposed to add that?

I tried putting it in the cargo.toml but the problem persisted

@mockersf
Copy link
Member

mockersf commented Nov 27, 2021

you should add it here https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions

alternatively, if you are on latest rust, you can use edition 2021 which will select it by default

@thechubbypanda
Copy link
Author

Cheers @mockersf, 2021 did the trick. I was using 2018 still for some reason lol

@DJMcNab
Copy link
Member

DJMcNab commented Nov 27, 2021

I think we should work with the wgpu team to provide more actionable guidance there.

Hopefully compile_error can accept a multiline string.

@thechubbypanda
Copy link
Author

thechubbypanda commented Nov 27, 2021

Agreed, that error message doesn't really point you to a solution.

I did my usual google run and found nothing.

Only thing I found was this https://doc.rust-lang.org/cargo/reference/resolver.html and it doesn't even show you how to change the resolver

I take that back I just didn't read far enough haha

@thechubbypanda thechubbypanda changed the title wgpu-hal causes wgpu-hal causes wgpu-hal resolver error Nov 27, 2021
@thechubbypanda thechubbypanda changed the title wgpu-hal causes wgpu-hal resolver error wgpu-hal causes resolver error Nov 27, 2021
@thechubbypanda
Copy link
Author

Cheers @alice-i-cecile XD

@riverfr0zen
Copy link

Just a note for those new to Rust like me that if your packages are in a workspace, you need to indicate the resolver in the workspace's Cargo.toml file also. But in the workspace's Cargo.toml, it has to be " "resolver = 2", NOT edition = "2021". This page goes into it.

@twe4ked
Copy link

twe4ked commented May 16, 2022

This page goes into it.

404s for me now.

Direct link: rust-lang/cargo#9956

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

No branches or pull requests

5 participants