gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.36k stars 546 forks source link

3 build errors on Windows #3786

Closed IronThread closed 2 years ago

IronThread commented 2 years ago
  Compiling gfx-backend-gl v0.9.0
error[E0599]: no variant or associated item named `Xlib` found for enum `RawWindowHandle` in the current scope
   --> C:\Users\Santino\.cargo\registry\src\github.com-1285ae84e5963aae\gfx-backend-gl-0.9.0\src\window\egl.rs:352:18
    |
352 |             Rwh::Xlib(handle) => {
    |                  ^^^^ variant or associated item not found in `RawWindowHandle`

error[E0599]: no variant or associated item named `Xcb` found for enum `RawWindowHandle` in the current scope
   --> C:\Users\Santino\.cargo\registry\src\github.com-1285ae84e5963aae\gfx-backend-gl-0.9.0\src\window\egl.rs:357:18
    |
357 |             Rwh::Xcb(handle) => {
    |                  ^^^ variant or associated item not found in `RawWindowHandle`

error[E0599]: no variant or associated item named `Wayland` found for enum `RawWindowHandle` in the current scope
   --> C:\Users\Santino\.cargo\registry\src\github.com-1285ae84e5963aae\gfx-backend-gl-0.9.0\src\window\egl.rs:364:18
    |
364 |             Rwh::Wayland(handle) => {
    |                  ^^^^^^^ variant or associated item not found in `RawWindowHandle`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `gfx-backend-gl` due to 3 previous errors

rustc --version --verbose:

rustc 1.61.0-nightly (68369a041 2022-02-22)
binary: rustc
commit-hash: 68369a041cea809a87e5bd80701da90e0e0a4799
commit-date: 2022-02-22
host: i686-pc-windows-msvc
release: 1.61.0-nightly
LLVM version: 14.0.0
cwfitzgerald commented 2 years ago

The gfx-hal gl backend doesn't work on windows and shouldn't be compiled on the platform. How are you depending on gfx-hal?

IronThread commented 2 years ago

I have gfx-backend-gl = "0" on my dependencies table.

cwfitzgerald commented 2 years ago

You need to put the backend behind a platform specific dependency, see https://github.com/gfx-rs/wgpu/blob/v0.9/wgpu-core/Cargo.toml#L49