Subject: Mesa missing patches for Vulkan shared libraries

From: Mája Tomášek <[email-masked]>
Date: Sun, 02 Oct 2022 16:33:13 +0200

As per https://issues.guix.gnu.org/57297

> It was only recently that I was able to fix an issue with the tutorial
> program not finding the .so for the validation layer, by patching the
> layer manifest file with the full store path of the .so. A similar
> phase would need to be added to the mesa package definition for its
> device selection layer to work properly. The error from the mesa layer
> not being found when I run the basic tutorial program is:
>
> !! validation layer: libVkLayer_MESA_device_select.so: cannot open
> shared object file: No such file or directory

And the mentioned patch is:

> + #:phases #~(modify-phases %standard-phases
> +              (add-after 'install 'set-layer-path-in-manifest
> +                (lambda* (#:key outputs #:allow-other-keys)
> +                  (let* ((out (assoc-ref outputs "out"))
> +                              (manifest (string-append out
> +                                        "/share/vulkan/explicit_layer.d"
> +                                        "/VkLayer_khronos_validation.json")))
> +                          (substitute* manifest
> +                             (("\"libVkLayer_khronos_validation.so\"")
> +                              (string-append "\"" out
> "/lib/libVkLayer_khronos_validation.so\"")))))))))

This errors actually appears in more packages, for example vulkan-info
prints this error.

Patches to all shared vulkan libraries should be added into mesa, so
applications can actually load vulkan.