egui: failed to create glutin window surface

Describe the bug when i run the egui example hello_world,but it run failed.

$ cd examples
$ cargo run -p hello_world
warning: /home/xml/egui-0.20.1/crates/eframe/Cargo.toml: unused manifest key: target.cfg(not(target_arch = "wasm32")).dependencies.glutin.es
    Finished dev [unoptimized + debuginfo] target(s) in 0.35s
     Running `/home/xml/egui-0.20.1/target/debug/hello_world`
2022-12-28T10:02:53.267553Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.25    
libEGL warning: DRI2: failed to authenticate
thread 'main' panicked at 'failed to create glutin window surface: Error { raw_code: Some(12299), raw_os_message: None, kind: BadNativeWindow }', crates/eframe/src/native/run.rs:409:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

when i run it with RUST_BACKTRACE=1,i got that:

$ RUST_BACKTRACE=1 cargo run -p hello_world
warning: /home/xml/egui-0.20.1/crates/eframe/Cargo.toml: unused manifest key: target.cfg(not(target_arch = "wasm32")).dependencies.glutin.es
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `/home/xml/egui-0.20.1/target/debug/hello_world`
2022-12-28T10:12:18.211554Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.25    
libEGL warning: DRI2: failed to authenticate
thread 'main' panicked at 'failed to create glutin window surface: Error { raw_code: Some(12299), raw_os_message: None, kind: BadNativeWindow }', crates/eframe/src/native/run.rs:409:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/result.rs:1785:5
   3: core::result::Result<T,E>::expect
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/result.rs:1064:23
   4: new
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:407:30
   5: eframe::native::run::glow_integration::GlowWinitApp::create_glutin_windowed_context
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:505:26
   6: init_run_state
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:521:35
   7: <eframe::native::run::glow_integration::GlowWinitApp as eframe::native::run::WinitApp>::on_event
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:733:25
   8: {closure#0}<eframe::native::run::glow_integration::GlowWinitApp>
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:140:22
   9: winit::platform_impl::platform::sticky_exit_callback
             at /home/xml/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/winit-0.27.5/src/platform_impl/linux/mod.rs:849:9
  10: single_iteration<eframe::native::run::UserEvent, eframe::native::run::run_and_return::{closure_env#0}<eframe::native::run::glow_integration::GlowWinitApp>>
             at /home/xml/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:339:17
  11: run_return<eframe::native::run::UserEvent, eframe::native::run::run_and_return::{closure_env#0}<eframe::native::run::glow_integration::GlowWinitApp>>
             at /home/xml/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:448:31
  12: winit::platform_impl::platform::EventLoop<T>::run_return
             at /home/xml/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/winit-0.27.5/src/platform_impl/linux/mod.rs:748:56
  13: <winit::event_loop::EventLoop<T> as winit::platform::run_return::EventLoopExtRunReturn>::run_return
             at /home/xml/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/winit-0.27.5/src/platform/run_return.rs:62:9
  14: run_and_return<eframe::native::run::glow_integration::GlowWinitApp>
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:107:5
  15: eframe::native::run::glow_integration::run_glow::{{closure}}
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:852:17
  16: eframe::native::run::with_event_loop::{{closure}}
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:96:9
  17: try_with<core::cell::RefCell<core::option::Option<winit::event_loop::EventLoop<eframe::native::run::UserEvent>>>, eframe::native::run::with_event_loop::{closure_env#0}<eframe::native::run::glow_integration::run_glow::{closure_env#0}>, ()>
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:445:16
  18: std::thread::local::LocalKey<T>::with
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/thread/local.rs:421:9
  19: eframe::native::run::with_event_loop
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:89:5
  20: eframe::native::run::glow_integration::run_glow
             at /data/home/xml/egui-0.20.1/crates/eframe/src/native/run.rs:845:13
  21: run_native
             at /data/home/xml/egui-0.20.1/crates/eframe/src/lib.rs:192:13
  22: main
             at /data/home/xml/egui-0.20.1/examples/hello_world/src/main.rs:13:5
  23: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

To Reproduce Steps to reproduce the behavior:

  1. get egui code
  2. cd examples
  3. cargo run -p hello_world

Expected behavior

Screenshots

Desktop (please complete the following information):

  • OS: UOS V20(base on debian) with X11 Graphic system
  • Browser Chromium
  • Version

detail info:

$ cat /etc/os-release 
PRETTY_NAME="UnionTech OS Desktop 20 Pro"
NAME="uos"
VERSION_ID="20"
VERSION="20"
ID=uos
HOME_URL="https://www.chinauos.com/"
BUG_REPORT_URL="http://bbs.chinauos.com"
VERSION_CODENAME=eagle

$ uname -a
Linux xml-PC 4.19.0-amd64-desktop #5312 SMP Mon Nov 7 14:31:47 CST 2022 x86_64 GNU/Linux

Smartphone (please complete the following information):

  • Device:
  • OS:
  • Browser
  • Version

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

@qiuzhiqian

Given that most of the stuff posted wrt logs here is not really helpful, because you’re not using glx. could you post eglinfo.

And on a https://github.com/emilk/egui/pull/2526 you can see PreferEgl, change it to FallbackEgl, thx, so we can compare GLX.

@qiuzhiqian can you try running the same project with

cargo run --features=glutin
$ cargo run --features=glutin
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `/home/xml/glow/target/debug/hello`
libEGL warning: DRI2: failed to authenticate
thread 'main' panicked at '0:1(10): error: GLSL 4.10 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES
', examples/hello/src/main.rs:106:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

run failed