diff mbox series

[bug#59453,core-updates] gnu: mesa: Fix library paths in Vulkan layer manifests.

Message ID 4782cd33fae4a0f5e120dab213753d9d51b6d94a.1669057759.git.kaelyn.alexi@protonmail.com
State New
Headers show
Series [bug#59453,core-updates] gnu: mesa: Fix library paths in Vulkan layer manifests. | expand

Commit Message

Kaelyn Takata Nov. 21, 2022, 7:09 p.m. UTC
* gnu/packages/gl.scm (mesa): Fix library paths in Vulkan layer manifests.
---
 gnu/packages/gl.scm | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)


base-commit: affaacf4f46639dcc8239a438cad11c2a6ef6c9a
--
2.38.1

Comments

Kaelyn Takata Jan. 21, 2023, 3:41 p.m. UTC | #1
Hi Guix devs,

Now that it's been a couple of months, I wanted to bump my core-updates patch to Mesa which fixes the library paths in Mesa's Vulkan layer manifest files (https://issues.guix.gnu.org/59453). The patch also resolves https://issues.guix.gnu.org/58251.

Cheers,
Kaelyn
Bruno Victal Jan. 21, 2023, 4:16 p.m. UTC | #2
On 2022-11-21 19:09, Kaelyn Takata via Guix-patches via wrote:
> * gnu/packages/gl.scm (mesa): Fix library paths in Vulkan layer manifests.
> ---
>  gnu/packages/gl.scm | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
> index dd62fac13e..c26a51cb32 100644
> --- a/gnu/packages/gl.scm
> +++ b/gnu/packages/gl.scm
> @@ -488,7 +488,28 @@ (define-public mesa
>                                                         file)
>                                                (symlink reference file)))
>                                          others))))
> -                         (delete-duplicates inodes))))))))
> +                         (delete-duplicates inodes)))))
> +         (add-after 'install 'set-layer-path-in-manifests
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))

Using G-Expressions would be better here, since you're modifying this package,
you could take the opportunity to modernize/rewrite this package definition using G-Expressions.
(Keep the rewrite and this fix in separate commits)

> +                    (implicit-path (string-append
> +                                    out
> +                                    "/share/vulkan/implicit_layer.d/"))
> +                    (explicit-path (string-append
> +                                    out
> +                                    "/share/vulkan/explicit_layer.d/"))
> +                    (fix-layer-path
> +                     (lambda (layer-name)
> +                       (let* ((explicit (string-append explicit-path layer-name ".json"))
> +                              (implicit (string-append implicit-path layer-name ".json"))
> +                              (manifest (if (file-exists? explicit)
> +                                            explicit
> +                                            implicit)))
> +                         (substitute* manifest
> +                           (((string-append "\"lib" layer-name ".so\""))
> +                             (string-append "\"" out "/lib/lib" layer-name ".so\"")))))))
> +               (for-each fix-layer-path '("VkLayer_MESA_device_select"
> +                                          "VkLayer_MESA_overlay"))))))))
>      (home-page "https://mesa3d.org/")
>      (synopsis "OpenGL and Vulkan implementations")
>      (description "Mesa is a free implementation of the OpenGL and Vulkan
> 
> base-commit: affaacf4f46639dcc8239a438cad11c2a6ef6c9a
> --
> 2.38.1
> 
> 
> 
> 
>
Kaelyn Takata Feb. 12, 2023, 6:20 p.m. UTC | #3
------- Original Message -------
On Saturday, January 21st, 2023 at 4:16 PM, Bruno Victal <mirai@makinata.eu> wrote:

>
> On 2022-11-21 19:09, Kaelyn Takata via Guix-patches via wrote:
>
> > * gnu/packages/gl.scm (mesa): Fix library paths in Vulkan layer manifests.
> > ---
> > gnu/packages/gl.scm | 23 ++++++++++++++++++++++-
> > 1 file changed, 22 insertions(+), 1 deletion(-)
> >
> > diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
> > index dd62fac13e..c26a51cb32 100644
> > --- a/gnu/packages/gl.scm
> > +++ b/gnu/packages/gl.scm
> > @@ -488,7 +488,28 @@ (define-public mesa
> > file)
> > (symlink reference file)))
> > others))))
> > - (delete-duplicates inodes))))))))
> > + (delete-duplicates inodes)))))
> > + (add-after 'install 'set-layer-path-in-manifests
> > + (lambda* (#:key outputs #:allow-other-keys)
> > + (let* ((out (assoc-ref outputs "out"))
>
>
> Using G-Expressions would be better here, since you're modifying this package,
> you could take the opportunity to modernize/rewrite this package definition using G-Expressions.
> (Keep the rewrite and this fix in separate commits)

Given the complexity of the mesa package definition including the numerous matches on %current-system, I'm not confident or comfortable in my ability to rewrite mesa's package-arguments to use gexps. I certainly don't want to delay fixing the Vulkan layer library paths on core-updates packages even longer than it already has been trying to rewrite a complex core package.

Cheers,
Kaelyn

>
> > + (implicit-path (string-append
> > + out
> > + "/share/vulkan/implicit_layer.d/"))
> > + (explicit-path (string-append
> > + out
> > + "/share/vulkan/explicit_layer.d/"))
> > + (fix-layer-path
> > + (lambda (layer-name)
> > + (let* ((explicit (string-append explicit-path layer-name ".json"))
> > + (implicit (string-append implicit-path layer-name ".json"))
> > + (manifest (if (file-exists? explicit)
> > + explicit
> > + implicit)))
> > + (substitute* manifest
> > + (((string-append "\"lib" layer-name ".so\""))
> > + (string-append "\"" out "/lib/lib" layer-name ".so\"")))))))
> > + (for-each fix-layer-path '("VkLayer_MESA_device_select"
> > + "VkLayer_MESA_overlay"))))))))
> > (home-page "https://mesa3d.org/")
> > (synopsis "OpenGL and Vulkan implementations")
> > (description "Mesa is a free implementation of the OpenGL and Vulkan
> >
> > base-commit: affaacf4f46639dcc8239a438cad11c2a6ef6c9a
> > --
> > 2.38.1
Kaelyn Takata April 19, 2023, 2:41 p.m. UTC | #4
Hi,

Some time back I mailed in https://issues.guix.gnu.org/59453 to fix an issue with the manifests for the vulkan layers that ship with mesa. Basically the error is that the manifests don't include the store path to the referenced libraries, only the file name. An example the error can be seen by running "vulkaninfo &| less", where this message is printed a few times:

ERROR: [Loader Message] Code 0 : libVkLayer_MESA_device_select.so: cannot open shared object file: No such file or directory


While I know it is late in the process of preparing core-updates for merging into master, I wanted to ask if it would be possible to have the patch addressed prior to the merge? I just encountered the error message again after having a need to check vulkaninfo and it reminded me of the patch. (The vulkan-validationlayers package that was recently merged to master from staging includes a similar phase for fixing the layer object path in its layer manifest.)

Thanks,
Kaelyn
Andreas Enge April 19, 2023, 3:26 p.m. UTC | #5
Hello,

thanks for bringing this back to our attention!

Am Wed, Apr 19, 2023 at 02:41:57PM +0000 schrieb Kaelyn:
> While I know it is late in the process of preparing core-updates for merging into master, I wanted to ask if it would be possible to have the patch addressed prior to the merge?

Given how many packages depend on mesa and their importance, I think it
would be safer to postpone the fix until after the merge; be it in a
dedicated mesa feature branch that could quickly be merged afterwards,
or better yet regroup other changes in this area. (Searching for open mesa
packages on issues.guix.gnu.org returns quite a few matches, this could be
a good occasion to sort them out.)

Andreas
diff mbox series

Patch

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index dd62fac13e..c26a51cb32 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -488,7 +488,28 @@  (define-public mesa
                                                        file)
                                               (symlink reference file)))
                                         others))))
-                         (delete-duplicates inodes))))))))
+                         (delete-duplicates inodes)))))
+         (add-after 'install 'set-layer-path-in-manifests
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (implicit-path (string-append
+                                    out
+                                    "/share/vulkan/implicit_layer.d/"))
+                    (explicit-path (string-append
+                                    out
+                                    "/share/vulkan/explicit_layer.d/"))
+                    (fix-layer-path
+                     (lambda (layer-name)
+                       (let* ((explicit (string-append explicit-path layer-name ".json"))
+                              (implicit (string-append implicit-path layer-name ".json"))
+                              (manifest (if (file-exists? explicit)
+                                            explicit
+                                            implicit)))
+                         (substitute* manifest
+                           (((string-append "\"lib" layer-name ".so\""))
+                             (string-append "\"" out "/lib/lib" layer-name ".so\"")))))))
+               (for-each fix-layer-path '("VkLayer_MESA_device_select"
+                                          "VkLayer_MESA_overlay"))))))))
     (home-page "https://mesa3d.org/")
     (synopsis "OpenGL and Vulkan implementations")
     (description "Mesa is a free implementation of the OpenGL and Vulkan