code
code copied to clipboard
ch6/ch6-particles fails with missing libX11.so.6
After executing cargo run I get the following error:
thread 'main' panicked at 'Failed to initialize any backend! Wayland status: NoWaylandLib X11 status: 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/tom/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.6/src/platform_impl/linux/mod.rs:757:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
As well as the first set of benchmark statements.
running on nixos with hyprland wayland window manager.
The solution for me was to run in a nix-shell with the following shell.nix
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
buildInputs = with pkgs; [cargo];
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
with pkgs;
lib.makeLibraryPath [
libGL
xorg.libX11
xorg.libXi
xorg.libXcursor
xorg.libXrandr
]
}"
'';
}