gfx-rs / gfx

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

Failed to run custom build command for `khronos-egl v2.1.1` #3534

Closed anthonyarusso closed 3 years ago

anthonyarusso commented 3 years ago

Context

I am a novice with Linux and Cargo alike. I am currently running commands from ChromeOS's "Crostini" Debian 10 (Buster) container.

I am aware that Vulkan support on Crostini is WIP, but was lead to believe WGPU would function properly if it targets an OpenGL backend.


OS and CPU Info

ChromeOS Version 86.0.4240.198 (Official Build) (64-bit) Linux 5.4.58-07649-ge120df5deade x86_64 Debian GNU/Linux 10 (buster) 10th Gen Intel Core i3

OpenGL / Mesa Info

OpenGL vendor string: Red Hat OpenGL renderer string: virgl OpenGL core profile version string: 4.3 (Core Profile) Mesa 19.2.8 OpenGL core profile shading language version string: 4.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.1 Mesa 19.2.8 OpenGL shading language version string: 1.40 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.2 Mesa 19.2.8 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 OpenGL ES profile extensions:

Cargo Info

Installed all Cargo packages related to WGPU today.

The Problem

Attempted to execute cargo run --example cube and was met with the following error: wgpu_error.txt

Attempted solutions

Installed Vulkan packages (only to later realize Crostini lacks support): sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-utils

Attempted to further update OpenGL / Mesa Packages. I believe I have the Debian Buster-Backports packages installed and up-to-date.

Attempted to set the WGPU_BACKEND environment variable listed in the README to gl.

I was unable to find such an environment variable by running printenv | grep "WGPU" or similar commands. Am I wrong to assume these are Bash environment variables? If not, where can I locate and change these?

Any help is appreciated. Please let me know if there is any more information you would like.

kvark commented 3 years ago

Did you see our CI scripts?

sudo apt-get install -y -qq libegl1-mesa-dev

Also, tracked upstream in https://github.com/timothee-haudebourg/khronos-egl/issues/8

anthonyarusso commented 3 years ago

Thank you for your quick response.

I did not see your CI Scripts, but now I know in the future to check there. Installing this package resolved my error with khronos-egl, however I am now receiving the following error:

Finished dev [unoptimized + debuginfo] target(s) in 0.54s
     Running `target/debug/examples/cube`
xkbcommon: ERROR: Key "<CAPS>" added to modifier map for multiple modifiers; Using Mod3, ignoring Lock
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/cube/../framework.rs:145:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

(Didn't mean to post yet, bumped the touch pad. I plan to dig around a bit if I am able.)

anthonyarusso commented 3 years ago

I apologize. Currently bed-ridden so I'm flailing about and clicking things I don't mean to. đŸ˜…

kvark commented 3 years ago

The error needs to be improved. This basically says that wgpu wasn't able to find a usable GPU adapter. I assume you don't have Vulkan installed/available? For your app, you control the mask of backends to allow. For the examples written against the framework, it's controlled by an environment variable. You can run GL stuff as:

WGPU_BACKEND=gl cargo run --example cube

Note that GL stuff doesn't work yet, we are on it.

anthonyarusso commented 3 years ago

No, Crostini does not yet support Vulkan but it is slated for early next year. I've seen the issues outlining OpenGL support for WGPU within GitHub.

Thanks for helping me grasp the situation.

Edit: Setting WGPU_BACKEND=gl gave the following error:

Finished dev [unoptimized + debuginfo] target(s) in 0.19s
     Running `target/debug/examples/cube`
xkbcommon: ERROR: Key "<CAPS>" added to modifier map for multiple modifiers; Using Mod3, ignoring Lock
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BadAttribute', /home/aarusso/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/1d14789/src/backend/gl/src/window/egl.rs:101:87
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

EGL seems to misbehaving again. I can only assume this is a Crostini / Chromebook issue. I'll poke around some forums dedicated to Crostini and see what I can find.

kvark commented 3 years ago

This may very well be our issue, but better filed to gfx-rs repo.

anthonyarusso commented 3 years ago

I've been asking around the Crostini community and am awaiting responses. Should I re-submit this issue under the gfx-rs repo and simply add / link this issue as related?

kvark commented 3 years ago

@anthonyarusso please file an issue about "BadAttribute" error specifically to gfx-rs repo. It's not the same as you reported here originally (failure to build vs failure to run).

anthonyarusso commented 3 years ago

Situation has changed again. Long story short: I deleted my local wgpu-rs Git repository and re-cloned. After running both cargo run --example cube and WGPU_BACKEND=gl cargo run --example cube I am now receiving the following error instead:

    Finished dev [unoptimized + debuginfo] target(s) in 0.34s
     Running `target/debug/examples/cube`
xkbcommon: ERROR: Key "<CAPS>" added to modifier map for multiple modifiers; Using Mod3, ignoring Lock
thread 'main' panicked at 'Unknown backend: g1', examples/cube/../framework.rs:119:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I can provided the full back trace as requested.

Would you still like me to create a new issue on gfx-rs now that I am unable to recreate the "BadAttribute" error?

kvark commented 3 years ago

thread 'main' panicked at 'Unknown backend: g1', examples/cube/../framework.rs:119:22

What's the wgpu-rs revision you are running, exactly? Sounds like an old one.

anthonyarusso commented 3 years ago

From Cargo.toml:

[patch."https://github.com/gfx-rs/wgpu"]
#wgpu-types = { version = "0.6", path = "../wgpu/wgpu-types" }
#wgpu-core = { version = "0.6", path = "../wgpu/wgpu-core" }

[patch."https://github.com/gfx-rs/subscriber"]
#wgpu-subscriber = { version = "0.1", path = "../subscriber" }

I ran cargo update and checked again. No changes to any of the version numbers provided above. Other utilities showed the same. max-version: 0.6.2.

kvark commented 3 years ago

@anthonyarusso what github revision are you on?

anthonyarusso commented 3 years ago

If you are referring to my commit hash, I just ran git pull and am now "up to date" on commit 26fa5c16c11ed22d0afcfd047453a0c1f7b3d218. Otherwise, I'm lost.

Should I ping you in my responses for the moment?

kvark commented 3 years ago

Pinging is not necessary, I just sometimes do this without thinking. I think your problem is that you are doing WGPU_BACKEND=g1 instead of WGPU_BACKEND=gl :)

anthonyarusso commented 3 years ago

WGPU_BACKEND=gl produces the following:

xkbcommon: ERROR: Key "<CAPS>" added to modifier map for multiple modifiers; Using Mod3, ignoring Lock
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/cube/../framework.rs:145:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Would you like the backtrace?

kvark commented 3 years ago

Could you attach the RUST_LOG=gfx_backend_gl=debug output perhaps?

anthonyarusso commented 3 years ago

Like so? WGPU_BACKEND=gl RUST_LOG=gfx_backend_gl=debug cargo run --example cube produces

Finished dev [unoptimized + debuginfo] target(s) in 0.67s
     Running `target/debug/examples/cube`
xkbcommon: ERROR: Key "<CAPS>" added to modifier map for multiple modifiers; Using Mod3, ignoring Lock
[0.074054 INFO]()(no module): Client extensions: "EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_wayland EGL_EXT_platform_x11 EGL_MESA_platform_gbm EGL_MESA_platform_surfaceless EGL_EXT_platform_device"
[0.117053 INFO]()(no module): Display vendor "Mesa Project", version (1, 4), extensions: "EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_CHROMIUM_sync_control EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_NOK_texture_from_pixmap EGL_WL_bind_wayland_display "
[0.117147 DEBUG]()(no module): Configurations:
[0.117243 DEBUG]()(no module):  CONFORMANT=0x4D, RENDERABLE=0x4D, NATIVE_RENDERABLE=0x1, SURFACE_TYPE=0x7
...
[0.126162 DEBUG]()(no module):  CONFORMANT=0x4D, RENDERABLE=0x4D, NATIVE_RENDERABLE=0x1, SURFACE_TYPE=0x6
[0.126625 WARN]()(no module): unable to create GLES (3, 1) context: BadAttribute
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/cube/../framework.rs:145:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
kvark commented 3 years ago

@anthonyarusso thank you, this is very helpful! I have an idea on how to fix that, but obviously I don't have a machine that complains in the same way as yours.