egui icon indicating copy to clipboard operation
egui copied to clipboard

Fail to run `glow` backend on NixOS

Open C0D3-M4513R opened this issue 2 years ago • 4 comments

Describe the bug

My app fails to launch properly.

To Reproduce Steps to reproduce the behavior:

  1. Be on Nixos Unstable
  2. git clone https://github.com/C0D3-M4513R/DexProtectOscRS.git
  3. git checkout dev (https://github.com/C0D3-M4513R/DexProtectOscRS/tree/dev)
  4. cd DexProtectOscRS
  5. nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
  6. cargo run --release

Expected behavior

My app launches.

Screenshots

[user@nixos:~/tmp/DexProtectOscRS-dev]$ cargo run --release
    Updating git repository `https://github.com/emilk/egui`
   Compiling emath v0.23.0 (https://github.com/emilk/egui?branch=master#fd75adb3)
   Compiling ecolor v0.23.0 (https://github.com/emilk/egui?branch=master#fd75adb3)
   Compiling epaint v0.23.0 (https://github.com/emilk/egui?branch=master#fd75adb3)
   Compiling egui v0.23.0 (https://github.com/emilk/egui?branch=master#fd75adb3)
   Compiling egui_glow v0.23.0 (https://github.com/emilk/egui?branch=master#fd75adb3)
   Compiling egui-winit v0.23.0 (https://github.com/emilk/egui?branch=master#fd75adb3)
   Compiling egui_tracing v0.2.1 (https://github.com/zakarumych/egui_tracing.git?rev=87ff66d75a47c1d372806f7d1c5fd60d986ba06b#87ff66d7)
   Compiling egui_extras v0.23.0
   Compiling eframe v0.23.0 (https://github.com/emilk/egui?branch=master#fd75adb3)
   Compiling dex_protect_osc_rs v0.1.2 (/home/user/tmp/DexProtectOscRS-dev/app)
    Finished release [optimized] target(s) in 1m 17s
     Running `target/release/dex_protect_osc_rs`
  2023-10-30T21:35:58.606481Z  INFO dex_protect_osc_rs: Logger initialized
    at app/src/main.rs:39

  2023-10-30T21:35:58.606746Z TRACE mio::poll: registering event source with poller: token=Token(1), interests=READABLE
    at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.9/src/poll.rs:543

  2023-10-30T21:35:58.607317Z  INFO dex_protect_osc_rs: Tokio Runtime initialized
    at app/src/main.rs:42

  2023-10-30T21:35:58.608229Z DEBUG eframe: Using the glow renderer
    at /home/user/.cargo/git/checkouts/egui-5e4507fa4153be06/fd75adb/crates/eframe/src/lib.rs:226

  2023-10-30T21:35:58.610487Z TRACE mio::poll: registering event source with poller: token=Token(0), interests=READABLE
    at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.9/src/poll.rs:543

  2023-10-30T21:35:58.611401Z DEBUG eframe::native::run: Entering the winit event loop (run_return)…
    at /home/user/.cargo/git/checkouts/egui-5e4507fa4153be06/fd75adb/crates/eframe/src/native/run.rs:141

  2023-10-30T21:35:58.611424Z DEBUG eframe::native::file_storage: Loading app state from "/home/user/.local/share/dexprotectosc-rs/app.ron"…
    at /home/user/.cargo/git/checkouts/egui-5e4507fa4153be06/fd75adb/crates/eframe/src/native/file_storage.rs:46

  2023-10-30T21:35:58.612010Z DEBUG eframe::native::run::glow_integration: trying to create glutin Display with config: ConfigTemplateBuilder { template: ConfigTemplate { color_buffer_type: Rgb { r_size: 8, g_size: 8, b_size: 8 }, alpha_size: 8, depth_size: 0, stencil_size: 0, num_samples: None, min_swap_interval: None, max_swap_interval: None, config_surface_types: WINDOW, api: None, transparency: false, single_buffering: false, stereoscopy: None, float_pixels: false, max_pbuffer_width: None, hardware_accelerated: None, max_pbuffer_height: None, native_window: None } }
    at /home/user/.cargo/git/checkouts/egui-5e4507fa4153be06/fd75adb/crates/eframe/src/native/run.rs:471

  2023-10-30T21:35:58.614811Z ERROR eframe::native::run: Exiting because of error: NoGlutinConfigs(ConfigTemplate { color_buffer_type: Rgb { r_size: 8, g_size: 8, b_size: 8 }, alpha_size: 8, depth_size: 0, stencil_size: 0, num_samples: None, min_swap_interval: None, max_swap_interval: None, config_surface_types: WINDOW, api: None, transparency: false, single_buffering: false, stereoscopy: None, float_pixels: false, max_pbuffer_width: None, hardware_accelerated: None, max_pbuffer_height: None, native_window: None }, Error { raw_code: None, raw_os_message: None, kind: BadConfig }) on event Resumed
    at /home/user/.cargo/git/checkouts/egui-5e4507fa4153be06/fd75adb/crates/eframe/src/native/run.rs:201

  2023-10-30T21:35:58.614832Z DEBUG eframe::native::run: Asking to exit event loop…
    at /home/user/.cargo/git/checkouts/egui-5e4507fa4153be06/fd75adb/crates/eframe/src/native/run.rs:229

  2023-10-30T21:35:58.614847Z DEBUG eframe::native::run: Received Event::LoopDestroyed - saving app state…
    at /home/user/.cargo/git/checkouts/egui-5e4507fa4153be06/fd75adb/crates/eframe/src/native/run.rs:154

  2023-10-30T21:35:58.614854Z DEBUG eframe::native::run: eframe window closed
    at /home/user/.cargo/git/checkouts/egui-5e4507fa4153be06/fd75adb/crates/eframe/src/native/run.rs:252

Error in eframe whilst trying to start the application: Found no glutin configs matching the template: ConfigTemplate { color_buffer_type: Rgb { r_size: 8, g_size: 8, b_size: 8 }, alpha_size: 8, depth_size: 0, stencil_size: 0, num_samples: None, min_swap_interval: None, max_swap_interval: None, config_surface_types: WINDOW, api: None, transparency: false, single_buffering: false, stereoscopy: None, float_pixels: false, max_pbuffer_width: None, hardware_accelerated: None, max_pbuffer_height: None, native_window: None }. Error: Error { raw_code: None, raw_os_message: None, kind: BadConfig }
GUI exited. Thank you for using DexProtectOSC-RS!

Desktop (please complete the following information):

  • OS: Nix Unstable
  • Browser: firefox
  • Version: 0.23.0 or master

Additional context

C0D3-M4513R avatar Oct 30 '23 21:10 C0D3-M4513R

Did you find a solution for this? I've been having the same error (also on nixpkgs unstable)

alexarice avatar Nov 20 '23 10:11 alexarice

I actually did. I found that nixos 23.05 doesn't have this issue. IDK if it matters, if the flake matches the system version for this.

I do also have some unstable bits in my system config, via a system flake, but the overall systemState is 23.05

C0D3-M4513R avatar Nov 20 '23 10:11 C0D3-M4513R

Pretty sure I've managed to track it down to this commit from this PR. However I don't have the time to sit through hours worth of cache-miss build times ATM to identify exactly where it went wrong.

Edit: Ok so this might be weirder than I first thought, when updating my system at different commits:

  • 1cf369a0dd162e2da454edd7880eb87bd4543eef (00:02 AM) does not work
  • c7e70840c0ea981bc97a265b2294246dcc33775d (00:56 AM) does work
  • a9e00367e77d2c0b9b6f7daf9abd0fe136f3cc57 (1:34 AM) does not work

I'm pretty clueless as to what is happening here

4JX avatar Dec 29 '23 00:12 4JX

@C0D3-M4513R @alexarice I know this sounds dumb but can you try simply running nix flake update for your project flake?

Seems like in the end the issue was a mismatch between the dependencies uses for building via the flake and the ones the system had.

4JX avatar Dec 30 '23 22:12 4JX

I just created a new project, and updated my flake and system to 23.11 and ran nix flake update.

Otherwise I basically inherited the packaging as described above. I still get this error when launching from my ide:

Error in eframe whilst trying to start the application: Found no glutin configs matching the template: ConfigTemplate { color_buffer_type: Rgb { r_size: 8, g_size: 8, b_size: 8 }, alpha_size: 8, depth_size: 0, stencil_size: 0, num_samples: None, min_swap_interval: None, max_swap_interval: None, config_surface_types: ConfigSurfaceTypes(WINDOW), api: None, transparency: false, single_buffering: false, stereoscopy: None, float_pixels: false, max_pbuffer_width: None, hardware_accelerated: None, max_pbuffer_height: None, native_window: None }. Error: Error { raw_code: None, raw_os_message: None, kind: BadConfig }

and this one, when using a nix develop shell and running the resulting binary inside the dev-shell:

  2024-01-30T12:13:20.527864Z DEBUG eframe: Using the glow renderer
    at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/eframe-0.25.0/src/lib.rs:259

Error in eframe whilst trying to start the application: winit EventLoopError: the requested operation is not supported by Winit

however nix build does work correctly. So at least I can run it somehow. It is very inconvenient for developing the app though.

Seems like in the end the issue was a mismatch between the dependencies uses for building via the flake and the ones the system had.

Also isn't the entire purpose of the nix-store to ensure that this doesn't happen? Afaik the flake will pull it's dependencies into the nix store (if not already present) and create a link to that project somehow.

C0D3-M4513R avatar Jan 30 '24 12:01 C0D3-M4513R

Also isn't the entire purpose of the nix-store to ensure that this doesn't happen? Afaik the flake will pull it's dependencies into the nix store (if not already present) and create a link to that project somehow.

Yes-ish. However I believe that there still needs to be some coherence for stuff like drivers as edge cases, it's not a truly fully self-contained system afaik.

Your app for example runs on my machine after switching the nixpkgs branch to match nixos-unstable (and a flake update) which is what I track on my system: image

There's always the possibility I have something enabled that does magically fix this along with the previously mentioned flake update, but I'd wager that's unlikely. In any case you can peek at my nixos config and see if that's the case.

4JX avatar Jan 30 '24 22:01 4JX

I feel like with the liked things in this issue there should be enough information for people to figure out, how to get egui to work on nixos.

C0D3-M4513R avatar Jan 31 '24 10:01 C0D3-M4513R