Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix where Vulkan validation layer JSON files are placed by the nixpkgs install phase #38316

Merged
merged 1 commit into from Jun 24, 2018

Conversation

Rotaerk
Copy link
Contributor

@Rotaerk Rotaerk commented Apr 2, 2018

Motivation for this change

When Vulkan looks for validation layers, it looks for JSON files in several directories. One of those directories is {vulkan-loader}/etc/vulkan/explicit_layer.d. This appears to be because {vulkan-loader}/etc is specified in SYSCONFDIR, which is used here in the Vulkan loader source. And according to the Vulkan loader's BUILD.md file: "You can further customize the installation directories by using the CMake variables CMAKE_INSTALL_SYSCONFDIR to rename the etc directory and CMAKE_INSTALL_DATADIR to rename the share directory". It seems pretty clear that the vulkan/explicit_layer.d folder should be in etc, not share.

As for how the current version seems to work already: A later folder that it checks for these JSON files (after it fails to find anything at {vulkan-loader}/etc/vulkan/explicit_layer.d) is {user-profile}/share/vulkan/explicit_layer.d. (No idea why it checks share instead of etc here, though.) When you install vulkan-loader via nix-env, it seems to also copy the files to that folder, which allows Vulkan to find them. However, in a context where you're running a nix-shell or nix-build without already having vulkan-loader installed via nix-env, it fails to find the files anywhere.

Things done

Changed the install phase to place vulkan/explicit_layer.d under {vulkan-loader}/etc instead of {vulkan-loader}/share.

Caveat: My only testing is that I ran vulkaninfo under nix-shell, with and without my change, and it worked (i.e. listed layers) only with my change. I also ran my own tutorial-based Vulkan program, built with a dependency on vulkan-loader, and it failed to find any installed validation layers until my fix was applied.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests) No such test exists for vulkan-loader
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip" Test failed, but I don't think it has anything to do with my change. See below.
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Rotaerk Rotaerk changed the title Vulkan etc Fix where Vulkan validation layer JSON files are placed by the nixpkgs install phase Apr 2, 2018
@Rotaerk Rotaerk force-pushed the vulkan-etc branch 2 times, most recently from a7746b1 to 714caad Compare April 3, 2018 01:09
@Rotaerk
Copy link
Contributor Author

Rotaerk commented Jun 10, 2018

I tested with nox-review after already creating this PR using nix-shell -p nox --run "nox-review pr 38316". It failed to build, but I don't think it's due to my change:

***
Unfortunately, we cannot download file vstsdk368_08_11_2017_build_121.zip automatically.
Please go to http://www.steinberg.net/en/company/developers.html to download it yourself, and add it to the Nix store
using either
  nix-store --add-fixed sha256 vstsdk368_08_11_2017_build_121.zip
or
  nix-prefetch-url --type sha256 file:///path/to/vstsdk368_08_11_2017_build_121.zip

***

builder for '/nix/store/3g33wazkn3wbzama0a0ra29z6dv7scyb-vstsdk368_08_11_2017_build_121.zip.drv' failed with exit code 1
cannot build derivation '/nix/store/lxv7mfl2x1r1kg30s1462pnw9nhaqz21-vstsdk368_08_11_2017_build_121.drv': 1 dependencies couldn't be built
building '/nix/store/iv1a5pkprjsswxqcknj78zv8mmfvsj0y-vulkan-loader-1.1.70.0.drv'...
cannot build derivation '/nix/store/2xqnlb5f6lrbapnzfy7zi962548rf76p-airwave-1.3.3.drv': 1 dependencies couldn't be built
error: build of '/nix/store/1kdsgbd2i8wn9zv0qd7jbcvymxnq8caa-playonlinux-4.2.12.drv', '/nix/store/2xqnlb5f6lrbapnzfy7zi962548rf76p-airwave-1.3.3.drv', '/nix/store/2y4myqdaxyxlgz9p9xsi0595c8052g4q-libretro-nestopia-2017-06-04.drv', '/nix/store/30z53wa828wm65ppchh8mn03z0npmlsk-libretro-vba-next-2017-06-04.drv', '/nix/store/3dml7s6qyqi9rvx0i1cj9zhslrkbi4b8-libretro-gambatte-2017-06-04.drv', '/nix/store/597i98bbwbxamr7bqh375mxwhsf3pcvc-wine-3.0.1.drv', '/nix/store/5j8q9myxsdk9nx8nly1hbf2sjs6wvgj3-libretro-fba-2017-06-04.drv', '/nix/store/5kjbx6a54s6br89d6lramfmdkv20vj3p-wine-3.9-staging.drv', '/nix/store/7gwis0h1r1c0yrb96zqdy1h8m9zppb0p-libretro-scummvm-2017-06-04.drv', '/nix/store/7mkg8585bjkbzv3ippigbrpiqx7rwds7-wine-3.0.1.drv', '/nix/store/89sijlvbiajjn86nyg7x0chhl1nw3wl8-libretro-reicast-2017-06-04.drv', '/nix/store/8gp86vc9zm8lf9akxnrcr4345pfr4r8r-libretro-mgba-2017-06-04.drv', '/nix/store/8rr8vix2mkxasz02qbl1j2yls6xxdrrr-retroarch-bare-1.7.1.drv', '/nix/store/8xyj54skqsy84pai9vnpbxgv7b6gnd09-libretro-higan-sfc-2017-06-04.drv', '/nix/store/9l8pjskr1hw58i28xhb5dpdd8n5by974-pipelight-0.2.8.2.drv', '/nix/store/9sd6jsdpbrfy2vkqxmki67x7fr0hawwx-libretro-mupen64plus-2017-06-04.drv', '/nix/store/bid132xd75ivs91w7r2x28xdx8k3awv9-libretro-picodrive-2017-06-04.drv', '/nix/store/bpw8zwyi3jk302215d0h78nillz5qqiw-libretro-mame-2017-06-04.drv', '/nix/store/g960qi3irs5vvjzv20y2f5692jsxl399-libretro-dolphin-2017-06-04.drv', '/nix/store/gkkymla5y6rzv76bsrvrzad5sg5p89rh-renderdoc-0.91.drv', '/nix/store/h1qaac2kqnnkk2wq6r6az6naq5gi01mb-steam-run.drv', '/nix/store/iv1a5pkprjsswxqcknj78zv8mmfvsj0y-vulkan-loader-1.1.70.0.drv', '/nix/store/j8cixm10gfk3fwahy7jin34s338izr7x-beetle-psx.drv', '/nix/store/jllvjqgkpgafkpdrkvbdlipjp0qylsyz-wine-3.9-staging.drv', '/nix/store/kpvs7rk862lmhn2cghv127s252ffn5w8-libretro-fceumm-2017-06-04.drv', '/nix/store/kvbcffmd6hdnrglzckk5ayi8l1rcig9p-libretro-vbam-2017-06-04.drv', '/nix/store/kypk1pky3wf06px9cpsfv51nwppbx1sa-libretro-parallel-n64-2017-06-04.drv', '/nix/store/llblkwgpn957n51ixika5cq2cqlglna4-retroarch-1.7.1.drv', '/nix/store/m05bi47dvr1l7lj0m816fy4wj1bwldx5-rpcs3-2018-02-23.drv', '/nix/store/mf33q6y5cagpyc99zyw8m77yyjnc6ppz-wine-3.9.drv', '/nix/store/miawnbaciw3q368kfhrpv17gfgi5jzaf-libretro-genesis-plus-gx-2017-06-04.drv', '/nix/store/mwz8iw95g984j5wb5mv7j8zsz6knk3d5-libretro-prboom-2017-06-04.drv', '/nix/store/nghffcbj7kacgfkr1bzi9im81sf2lc77-libretro-stella-2017-06-04.drv', '/nix/store/nrjqpwd0ll5nx7mafq9f9miwg4yq2f47-libretro-4do-2017-06-04.drv', '/nix/store/p1gr0hsmk5zr3npc2wcjs3ggf5k6j3b9-libretro-snes9x-2017-06-04.drv', '/nix/store/pw0rkpc0m554kk5h4np138cvg5428prz-beetle-saturn.drv', '/nix/store/qbx06cihpk8gkgy5px07jbb5p4xp0h14-libretro-bsnes-mercury-accuracy-2017-06-04.drv', '/nix/store/r4610x7nk52rifhsyix1l8ickj3q4404-libretro-quicknes-2017-06-04.drv', '/nix/store/vd0g54r6yrjsvd1xwdvv19wfa0h2vsm5-vkquake-0.97.3.drv', '/nix/store/vxp6mwrkav402ckiglb38m4bki8xvvd9-libretro-snes9x-next-2017-06-04.drv', '/nix/store/wdfzymvs0wg4xh011ib2byb7x5pi8sck-winetricks-20180513.drv', '/nix/store/wlwfg0gd1xav6xmk66wsya1jldmpwagw-libretro-ppsspp-2017-06-04.drv', '/nix/store/x13zvpbwkqby27aq5yfrxkr0z2hmw2n6-libretro-desmume-2017-06-04.drv', '/nix/store/yj824sbsz3vz18bx6dx3x3z75gff97c9-beetle-pce-fast.drv' failed
The invocation of "nix-build -A winePackages.base -A libretro.stella -A wineStable -A libretro.fceumm -A libretro.snes9x -A retroarch -A vkquake -A winePackages.unstable -A pipelight -A libretro.picodrive -A wineStaging -A libretro.parallel-n64 -A rpcs3 -A libretro._4do -A libretro.reicast -A libretro.snes9x-next -A libretro.ppsspp -A libretro.mame -A libretro.dolphin -A retroarchBare -A libretro.vba-next -A steam-run-native -A renderdoc -A libretro.genesis-plus-gx -A libretro.fba -A winePackages.stable -A libretro.beetle-pce-fast -A vulkan-loader -A libretro.nestopia -A libretro.beetle-saturn -A airwave -A libretro.higan-sfc -A wine -A libretro.desmume -A libretro.scummvm -A wine-staging -A wineUnstable -A libretro.mgba -A libretro.gambatte -A libretro.prboom -A winePackages.staging -A libretro.bsnes-mercury -A libretro.beetle-psx -A libretro.vba-m -A wineFull -A libretro.quicknes -A libretro.mupen64plus -A winetricks -A playonlinux /home/rotaerk/.nox/nixpkgs" failed

@7c6f434c
Copy link
Member

I think I know why these are installed into /share/: because if you install into systemPackages it is almost for sure that /share is in pathsToLink, and /etc is quite likely to be missing. I think it is safer to copy to /etc, as you do, but symlink to /share for now and then evaluate the options; unless you want to test this with global installation.

@infinisil
Copy link
Member

I also suggest rebasing this on staging, since quiet a lot of stuff needs to be rebuilt.

@7c6f434c
Copy link
Member

@GrahamcOfBorg eval

When vulkan tries to load validation layers, it looks for JSON files in
several directories, one of which is:

<vulkan-loader>/etc/vulkan/explicit_layer.d

It does *not* look in:

<vulkan-loader>/share/vulkan/explicit_layer.d

Yet that is where the install phase of the vulkan-loader default.nix
places the files.  Thus, I modified the install phase to place them in
the etc location instead.
@Rotaerk
Copy link
Contributor Author

Rotaerk commented Jun 23, 2018

I've made the suggested changes. Rebased onto staging, and added the creation of a /share symlink to /etc. I also removed a redundant mkdir of $out/lib.

@7c6f434c
Copy link
Member

@infinisil Meh, Wine rebuild + libretro, you say like it is a big deal… But oh well, I don't want to ping-pong this PR between master and staging branches.

@7c6f434c 7c6f434c merged commit f8b0f68 into NixOS:staging Jun 24, 2018
@Rotaerk
Copy link
Contributor Author

Rotaerk commented Jun 24, 2018

@7c6f434c, thanks!

@Rotaerk Rotaerk deleted the vulkan-etc branch June 24, 2018 14:58
@Rotaerk Rotaerk restored the vulkan-etc branch July 6, 2018 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants