You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is inherently going to be a little meandering because I am not entirely familiar with the issues I'm having. Which is largely my fault for using such a niche OS, but also some fault lies in the completely bonkers world that is the intersection of graphics drivers, dynamic linking, and dependency management in general at the distro level.
I am hoping to merely make the maintainers aware and, mostly, hoping for a nod to this in the documentation more than any substantive codebase changes.
There are two primary blockers to running bevy out of the box on NixOS:
without a build.rs, bevy fails to link to Vulkan. I don't know how much of this is NixOS's fault for being weird (or how much of it is specific to my common Nvidia GPU).
glslang_validator needs to be patched to find it's dependency on libstdc++.so.6. I know most of this is NixOS's fault for being weird, but it also seem like an odd implementation.
Steps to successfully run Bevy examples:
Enter a nix-shell with nix-shell -p pkgconfig x11 xorg.libXcursor xorg.libXrandr xorg.libXi vulkan-tools lutris vulkan-headers vulkan-loader vulkan-validation-layers alsaLib. I have not yet tested to see which, if any, of the vulkan packages can be removed. There may be more dependencies that I don't have listed here because I have them installed globally. For the most part, what is needed is usually fairly easy to find. The build will complain, you nix search <missing item>, and add it to the list.
Create a build.rs file.
fnmain(){ifcfg!(target_os = "linux"){// these pragmas are optional on my system but left as examples if you run into trouble.// println!("cargo:rustc-link-lib=X11");// println!("cargo:rustc-link-lib=Xcursor");// println!("cargo:rustc-link-lib=Xrandr");// println!("cargo:rustc-link-lib=Xi");println!("cargo:rustc-link-lib=vulkan");}}
Try to run an example! Any example! We just need a particular dependency to be built.
find target -type f -name glslang_validator in order to find glslang_validator in target/debug/build/bevy-glsl-to-spirv-<hash>/out/glslang_validator. export OUT_DIR="$(dirname $(find target -type f -name glslang_validator))" (you don't have to export it but we need the path for later).
if you run ldd $OUT_DIR/glslang_validator, at least on my system, libstdc++.so.6 is not found. install (globally or in your nix-shell) any of the results found by nix-locate -w libstdc++.so.6. I'm using nixos.gcc-unwrapped below. In theory you can use any of the ones in find -L /nix/store -type f -name libstdc++.so.6.
We discussed this semi-recently in gfx-rs/wgpu-rs#332
The conclusion was that it should be handled by the "-sys" crate at the lowest level, so Ash in our case - ash-rs/ash#312
This issue is inherently going to be a little meandering because I am not entirely familiar with the issues I'm having. Which is largely my fault for using such a niche OS, but also some fault lies in the completely bonkers world that is the intersection of graphics drivers, dynamic linking, and dependency management in general at the distro level.
I am hoping to merely make the maintainers aware and, mostly, hoping for a nod to this in the documentation more than any substantive codebase changes.
There are two primary blockers to running bevy out of the box on NixOS:
build.rs
, bevy fails to link to Vulkan. I don't know how much of this is NixOS's fault for being weird (or how much of it is specific to my common Nvidia GPU).glslang_validator
needs to be patched to find it's dependency onlibstdc++.so.6
. I know most of this is NixOS's fault for being weird, but it also seem like an odd implementation.Steps to successfully run Bevy examples:
nix-shell -p pkgconfig x11 xorg.libXcursor xorg.libXrandr xorg.libXi vulkan-tools lutris vulkan-headers vulkan-loader vulkan-validation-layers alsaLib
. I have not yet tested to see which, if any, of the vulkan packages can be removed. There may be more dependencies that I don't have listed here because I have them installed globally. For the most part, what is needed is usually fairly easy to find. The build will complain, younix search <missing item>
, and add it to the list.build.rs
file.find target -type f -name glslang_validator
in order to findglslang_validator
intarget/debug/build/bevy-glsl-to-spirv-<hash>/out/glslang_validator
.export OUT_DIR="$(dirname $(find target -type f -name glslang_validator))"
(you don't have to export it but we need the path for later).ldd $OUT_DIR/glslang_validator
, at least on my system, libstdc++.so.6 is not found. install (globally or in your nix-shell) any of the results found bynix-locate -w libstdc++.so.6
. I'm using nixos.gcc-unwrapped below. In theory you can use any of the ones infind -L /nix/store -type f -name libstdc++.so.6
.patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath /nix/store/784rh7jrfhagbkydjfrv68h9x3g4gqmk-gcc-8.3.0-lib/lib $OUT_DIR/glslang_validator
The text was updated successfully, but these errors were encountered: