glutin icon indicating copy to clipboard operation
glutin copied to clipboard

panic in egl when creating example window

Open tarantoa opened this issue 2 years ago • 4 comments

I tried to create the example window after cloning the repo by running cargo run --example window, but failed with the following panic:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /mnt/d/dev/git/glium-projects/glutin/glutin/src/api/egl/mod.rs:424:32

With the full output at: https://pastebin.com/keEwXBtr

Panic persisted when rust nightly 1.62.0-nightly, and rust stable 1.60.0. Running in Ubunbtu on WSL for Windows 11.

tarantoa avatar Apr 24 '22 17:04 tarantoa

Same issue here on NixOS.

I assumed this was a missing library since that's usually the problem on Nix, but if Ubuntu has the same issue that might not be the case.

System: NixOS WM: Sway / Wayland

Same issue here on NixOS.

I assumed this was a missing library since that's usually the problem on Nix, but if Ubuntu has the same issue that might not be the case.

System: NixOS WM: Sway / Wayland

Available libraries:

pkgconfig
            cmake
            xorg.libxcb
            xorg.libXfixes
            libxkbcommon
            fontconfig
            fontconfig.lib
            wayland
Backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.28.0/src/api/egl/mod.rs:424:32
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/library/core/src/panicking.rs:48:5
   3: core::option::Option::unwrap
             at /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/library/core/src/option.rs:755:21
   4: glutin::api::egl::Context::new
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.28.0/src/api/egl/mod.rs:424:19
   5: glutin::platform_impl::platform_impl::wayland::Context::new_raw_context
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.28.0/src/platform_impl/unix/wayland.rs:124:13
   6: glutin::platform_impl::platform_impl::wayland::Context::new
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.28.0/src/platform_impl/unix/wayland.rs:105:23
   7: glutin::platform_impl::platform_impl::Context::new_windowed
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.28.0/src/platform_impl/unix/mod.rs:113:20
   8: glutin::windowed::>::build_windowed
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.28.0/src/windowed.rs:341:9
   9: i_slint_backend_gl::glcontext::OpenGLContext::new_context_and_renderer::{{closure}}::{{closure}}
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-gl-0.2.2/glcontext.rs:121:25
  10: core::ops::function::FnOnce::call_once
             at /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/library/core/src/ops/function.rs:248:5
  11: i_slint_backend_gl::glcontext::OpenGLContext::new_context_and_renderer::{{closure}}
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-gl-0.2.2/glcontext.rs:157:27
  12: i_slint_backend_gl::event_loop::with_window_target::{{closure}}
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-gl-0.2.2/event_loop.rs:258:13
  13: std::thread::local::LocalKey::try_with
             at /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/library/std/src/thread/local.rs:445:16
  14: std::thread::local::LocalKey::with
             at /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/library/std/src/thread/local.rs:421:9
  15: i_slint_backend_gl::event_loop::with_window_target
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-gl-0.2.2/event_loop.rs:254:9
  16: i_slint_backend_gl::glcontext::OpenGLContext::new_context_and_renderer
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-gl-0.2.2/glcontext.rs:108:36
  17: <:glwindow::glwindow as i_slint_core::window::platformwindow>::show
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-backend-gl-0.2.2/glwindow.rs:459:13
  18: i_slint_core::window::Window::show
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/window.rs:529:9
  19: i_slint_core::api::Window::show
             at /home/theduke/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/i-slint-core-0.2.2/api.rs:122:9
  20: <:slint_generatedmainwindow::mainwindow as i_slint_core::api::componenthandle>::show
             at ./src/main.rs:5:1
  21: <:slint_generatedmainwindow::mainwindow as i_slint_core::api::componenthandle>::run
             at ./src/main.rs:5:1
  22: sysman::main
             at ./src/main.rs:2:5
  23: core::ops::function::FnOnce::call_once
             at /rustc/e1b71feb592ba64805689e2b15b9fa570182c442/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

theduke avatar May 05 '22 21:05 theduke

I assumed this was a missing library since that's usually the problem on Nix, but if Ubuntu has the same issue that might not be the case.

It's not ubuntu, it was ubuntu in wsl on windows, so it's complitelly different thing.

@theduke in your case look at what alacritty requires to run in nix package and rpath thingy they do.

kchibisov avatar May 05 '22 21:05 kchibisov

Ah, in my case I was missing libGL.

theduke avatar May 05 '22 22:05 theduke

As a workaround, you should be able to run the application from WSL as a Windows executable instead. This worked for me, getting started on another project:

# One time setup
sudo apt update && sudo apt install mingw-w64
rustup target add x86_64-pc-windows-gnu

# Run the application
cargo run --target x86_64-pc-windows-gnu

You may need to tweak this for your particular machine. To obtain a list of available targets:

rustc --print target-list

thombruce avatar Jun 01 '22 04:06 thombruce

Fixed in https://github.com/rust-windowing/glutin/pull/1435. If not reopen with a new information.

kchibisov avatar Sep 03 '22 06:09 kchibisov