raphamorim / rio

A hardware-accelerated GPU terminal emulator focusing to run in desktops and browsers.
https://raphamorim.io/rio
MIT License
3.81k stars 122 forks source link

XKBNotFound on Nix/Wayland #233

Closed attilaolah closed 1 year ago

attilaolah commented 1 year ago

I'm not sure how to extort more debug information from this, RUST_BACKTRACE seems to do nothing.

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /build/rio-0.0.18-vendor.tar.gz/wgpu-hal/src/gles/egl.rs:751:73
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fish: Job 1, 'rio' terminated by signal SIGABRT (Abort)

I tried Rio using nix-shell --packages rio --run rio, and I got version 0.0.18.

raphamorim commented 1 year ago

Hey there, @attilaolah thanks for the issue, are you using ARM?

Also, could you try with latest release 0.0.19 (think hasn't published yet in nix pkgs yet)

attilaolah commented 1 year ago

No I'm using x86_64, with Arch as the host OS and running Nix from systemd with home-manager. I'm using the Nvidia proprietary drivers. I think I'm on Wayland, but wouldn't bet my life on it.

attilaolah commented 1 year ago

Let me try to just rebuild from the main branch, that way I can enable that backtrace too.

attilaolah commented 1 year ago

I get a different error with cargo run from the main branch, which is probably due to me not having the libX11.so.6 shared library. I can install it too using Nix, but then it ends up being in this location:

/nix/store/sk3yadd1ah9qw0n6k4zgigw6k93hc1gr-libX11-1.8.6/lib/libX11.so.6

The full error from cargo run is:

    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/rio`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: LibraryOpenError(OpenError { kind: Library, detail: "opening library failed (libX11.so.6: cannot open shared object file: No such file or directory); opening library failed (libX11.so: cannot open shared object file: No such file or directory)" })', /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/mod.rs:763:55
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

With more backtrace:

    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/rio`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: LibraryOpenError(OpenError { kind: Library, detail: "opening library failed (libX11.so.6: cannot open shared object file: No such file or directory); opening library failed (libX11.so: cannot open shared object file: No such file or directory)" })', /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/mod.rs:763:55
stack backtrace:
   0: rust_begin_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1076:23
   4: winit::platform_impl::platform::EventLoop<T>::new
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/mod.rs:763:23
   5: winit::event_loop::EventLoopBuilder<T>::build
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/event_loop.rs:127:25
   6: rio::main::{{closure}}
             at ./rio/src/main.rs:139:9
   7: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/park.rs:283:63
   8: tokio::runtime::coop::with_budget
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/coop.rs:107:5
   9: tokio::runtime::coop::budget
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/coop.rs:73:5
  10: tokio::runtime::park::CachedParkThread::block_on
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/park.rs:283:31
  11: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context/blocking.rs:66:9
  12: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/mod.rs:87:13
  13: tokio::runtime::context::runtime::enter_runtime
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context/runtime.rs:65:16
  14: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/mod.rs:86:9
  15: tokio::runtime::runtime::Runtime::block_on
             at /home/atl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/runtime.rs:313:45
  16: rio::main
             at ./rio/src/main.rs:146:5
  17: core::ops::function::FnOnce::call_once
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
attilaolah commented 1 year ago

I think some LD_LIBRARY_PATH magic should be able to solve this, but also, why do I need the X11 lib? Will Rio not run on Wayland?

attilaolah commented 1 year ago

I now have the following LD_LIBRARY_PATH setup:

LD_LIBRARY_PATH="$(
  nix --extra-experimental-features "nix-command flakes" eval --raw nixpkgs#xorg.libX11
)/lib:$(
  nix --extra-experimental-features "nix-command flakes" eval --raw nixpkgs#xorg.libXcursor
)/lib:$(
  nix --extra-experimental-features "nix-command flakes" eval --raw nixpkgs#xorg.libXrandr
)/lib:$(
  nix --extra-experimental-features "nix-command flakes" eval --raw nixpkgs#xorg.libXi
)/lib" cargo run

And I get the following error:

    Finished dev [unoptimized + debuginfo] target(s) in 0.16s
     Running `target/debug/rio`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: XKBNotFound', …/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/x11/mod.rs:337:85
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I think I'm getting somewhere.

tom-wegener commented 1 year ago

I have the same error as described in the issue description with my home manager (nix) setup but I'm able to build the app using the repository and using the wayland feature (via cargo build --release --no-default-features --features=wayland or cargo run --no-default-features --features=wayland) and on fedora. Maybe that helps.

Building the app with withWayland as override option did not help, still getting the error.

Full backtrace:

❯ RUST_BACKTRACE=full rio
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /build/rio-0.0.18-vendor.tar.gz/wgpu-hal/src/gles/egl.rs:751:73
stack backtrace:
   0:     0x556c0ea16565 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf014552b94f53b0b
   1:     0x556c0e8565ff - core::fmt::write::hd931ce1f65786f99
   2:     0x556c0ea0f737 - std::io::Write::write_fmt::h6a6fd63a04e82ec7
   3:     0x556c0ea16365 - std::sys_common::backtrace::print::h1e42468794e7b82c
   4:     0x556c0e9fe1c0 - std::panicking::default_hook::{{closure}}::hbe45423b43205803
   5:     0x556c0e9fde83 - std::panicking::default_hook::h84640917dec96f40
   6:     0x556c0e9fe606 - std::panicking::rust_panic_with_hook::h3f828bf7de94854a
   7:     0x556c0ea167e4 - std::panicking::begin_panic_handler::{{closure}}::h1494d1b7b833ecd5
   8:     0x556c0ea16636 - std::sys_common::backtrace::__rust_end_short_backtrace::hfb56cb4321fb1fc8
   9:     0x556c0e9fe352 - rust_begin_unwind
  10:     0x556c0e7ae0f3 - core::panicking::panic_fmt::h69ad0a157a771ebb
  11:     0x556c0e7ae183 - core::panicking::panic::h49ef28648bcd6145
  12:     0x556c0ebb1e42 - <wgpu_hal::gles::egl::Instance as wgpu_hal::Instance<wgpu_hal::gles::Api>>::init::h10345af396465e0e
  13:     0x556c0eb764d0 - wgpu_core::instance::Instance::new::h603a678e69ab0908
  14:     0x556c0ead0961 - wgpu_core::hub::Global<G>::new::h2a347377a0b968ac
Aborted: oops, process 'rio' core dumped
raphamorim commented 1 year ago

@attilaolah have you made any progress after the last comment.

Haven’t read yet the whole thread but wondering if is connected to this issue https://github.com/gfx-rs/wgpu/issues/1492

attilaolah commented 1 year ago

No progress for now, but I'm pretty sure it's not a Rio issue, feel free to close.

raphamorim commented 1 year ago

Closing it for now but mentioning @otavio just in case have any idea regarding it

attilaolah commented 1 year ago

I think in the end this ultimately was caused by non-NixOS drivers, and a solution is described in this article. Just noting here in case it helps future readers.

raphamorim commented 1 year ago

The rio version v0.0.22, prob have fixed automaticall with the wgpu update, since was quite "buggy" the adapter/driver selection.

zh4ngx commented 11 months ago

I'm still struggling with this on 0.0.27 from nixpkgs. I get this on both Fedora 39 and Ubuntu 22.04 running home manager.

When running the plain command

RUST_BACKTRACE=full rio
thread 'main' panicked at /build/rio-0.0.27-vendor.tar.gz/wgpu-hal/src/gles/egl.rs:798:88:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x55afea89c940 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h13e1a9b9ebeee924
   1:     0x55afea53711c - core::fmt::write::h4241cb35c54123f4
   2:     0x55afea8bf10e - std::io::Write::write_fmt::hfe37cff7f3aa0e3d
   3:     0x55afea89c715 - std::sys_common::backtrace::print::hc19a67331b3076ff
   4:     0x55afea8ad7a3 - std::panicking::default_hook::{{closure}}::h10c691ff00f3f05c
   5:     0x55afea8ad445 - std::panicking::default_hook::h726a8dc68ee97020
   6:     0x55afea8adbe6 - std::panicking::rust_panic_with_hook::hc77a4fa6bb2ac5c4
   7:     0x55afea89cce4 - std::panicking::begin_panic_handler::{{closure}}::h43aaf25fc9116c32
   8:     0x55afea89cb46 - std::sys_common::backtrace::__rust_end_short_backtrace::hc36652d4de1d92d2
   9:     0x55afea8ad932 - rust_begin_unwind
  10:     0x55afea4606c3 - core::panicking::panic_fmt::h208bab87ed164649
  11:     0x55afea460753 - core::panicking::panic::h2fc5e380fcaffe53
  12:     0x55afeab102ba - <wgpu_hal::gles::egl::Instance as wgpu_hal::Instance<wgpu_hal::gles::Api>>::init::h8908d7c9cb535d69
  13:     0x55afeaacd64c - wgpu_core::instance::Instance::new::hf77dbe955275ef17
  14:     0x55afeaab67e6 - wgpu::Instance::new::hba6fc2d78ef8e7b9
  15:     0x55afea7c6f95 - rio::screen::Screen::new::{{closure}}::h9aa9615f8ccc3b0c
  16:     0x55afea7e0d78 - rio::main::{{closure}}::h1ed72db406c6905f
  17:     0x55afea7dc2de - rio::main::h6fb41a3efcc9b655
  18:     0x55afea71f343 - std::sys_common::backtrace::__rust_begin_short_backtrace::h627dcf673a3a485b

And then when trying to set WGPU_BACKEND to vulkan:

RUST_BACKTRACE=full WGPU_BACKEND=vulkan rio
thread 'main' panicked at /build/source/sugarloaf/src/context/mod.rs:63:14:
Request adapter
stack backtrace:
   0:     0x556474e66940 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h13e1a9b9ebeee924
   1:     0x556474b0111c - core::fmt::write::h4241cb35c54123f4
   2:     0x556474e8910e - std::io::Write::write_fmt::hfe37cff7f3aa0e3d
   3:     0x556474e66715 - std::sys_common::backtrace::print::hc19a67331b3076ff
   4:     0x556474e777a3 - std::panicking::default_hook::{{closure}}::h10c691ff00f3f05c
   5:     0x556474e77445 - std::panicking::default_hook::h726a8dc68ee97020
   6:     0x556474e77be6 - std::panicking::rust_panic_with_hook::hc77a4fa6bb2ac5c4
   7:     0x556474e66d14 - std::panicking::begin_panic_handler::{{closure}}::h43aaf25fc9116c32
   8:     0x556474e66b46 - std::sys_common::backtrace::__rust_end_short_backtrace::hc36652d4de1d92d2
   9:     0x556474e77932 - rust_begin_unwind
  10:     0x556474a2a6c3 - core::panicking::panic_fmt::h208bab87ed164649
  11:     0x556474a2ab13 - core::option::expect_failed::ha2ecf51179db9c73
  12:     0x556474d94f5e - rio::screen::Screen::new::{{closure}}::h9aa9615f8ccc3b0c
  13:     0x556474daad78 - rio::main::{{closure}}::h1ed72db406c6905f
  14:     0x556474da62de - rio::main::h6fb41a3efcc9b655
  15:     0x556474ce9343 - std::sys_common::backtrace::__rust_begin_short_backtrace::h627dcf673a3a485b

I see things like patchElf, vulkan-loader, and libGL in nixpkgs. Am I looking in the right direction here?

testinfected commented 5 months ago

Still same pb described by @zh4ngx on Fedora 40 with 0.0.39 from nixpkgs