iced-rs/iced

error: WaylandError(Connection(NoWaylandLib)) when using nixos and shell.nix from DEPENDECIES.md

vavakado opened this issue · 1 comments

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

I am using wayland(hyprland) and when i try to run any example when in a nix-shell supplied from DEPENDECIES.md i get an error that there is "NoWaylandLib"

What is the expected behavior?

A running application

Version

crates.io release

Operating System

Linux

Do you have any log output?

❯ RUST_BACKTRACE=1 cargo run --package todos
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running `target/debug/todos`
thread 'main' panicked at /home/vavakado/Documents/projects/iced/winit/src/application.rs:151:10:
Create event loop: Os(OsError { line: 80, file: "/home/vavakado/.cargo/git/checkouts/winit-57d3141eaf559308/592bd15/src/platform_impl/linux/wayland/event_loop/mod.rs", error: WaylandError(Connection(NoWaylandLib)) })
stack backtrace:
   0: rust_begin_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
   1: core::panicking::panic_fmt
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/result.rs:1649:5
   3: core::result::Result<T,E>::expect
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/result.rs:1030:23
   4: iced_winit::application::run::{{closure}}
             at ./winit/src/application.rs:149:22
   5: futures_executor::local_pool::block_on::{{closure}}
             at /home/vavakado/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-executor-0.3.30/src/local_pool.rs:317:23
   6: futures_executor::local_pool::run_executor::{{closure}}
             at /home/vavakado/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-executor-0.3.30/src/local_pool.rs:90:37
   7: std::thread::local::LocalKey<T>::try_with
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/local.rs:286:16
   8: std::thread::local::LocalKey<T>::with
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/local.rs:262:9
   9: futures_executor::local_pool::run_executor
             at /home/vavakado/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-executor-0.3.30/src/local_pool.rs:86:5
  10: futures_executor::local_pool::block_on
             at /home/vavakado/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-executor-0.3.30/src/local_pool.rs:317:5
  11: iced::application::Application::run
             at ./src/application.rs:234:12
  12: iced::program::Program<P>::run_with
             at ./src/program.rs:247:9
  13: iced::program::Program<P>::run
             at ./src/program.rs:171:9
  14: todos::main
             at ./examples/todos/src/main.rs:20:5
  15: core::ops::function::FnOnce::call_once
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

winit (the windowing library iced uses) by default loads libwayland using dlopen. You need to tell nix to put libwayland on the path. Otherwise disable the dlopen feature in winit so that the compiler is forced to link to the system library.

rust-windowing/winit#3244
rust-windowing/winit#3603