GNU bug report logs - #71109
[PATCH] gnu: vulkan-tools: Wrap binaries with LD_LIBRARY_PATH.

Previous Next

Package: guix-patches;

Reported by: Sughosha <sughosha <at> disroot.org>

Date: Wed, 22 May 2024 09:41:02 UTC

Severity: normal

Done: John Kehayias <john.kehayias <at> protonmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71109 in the body.
You can then email your comments to 71109 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#71109; Package guix-patches. (Wed, 22 May 2024 09:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sughosha <sughosha <at> disroot.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 22 May 2024 09:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: guix-patches <at> gnu.org
Cc: Sughosha <sughosha <at> disroot.org>
Subject: [PATCH] gnu: vulkan-tools: Wrap binaries with LD_LIBRARY_PATH.
Date: Wed, 22 May 2024 15:06:19 +0530
This fixes not finding vulkan-loader.

* gnu/packages/vulkan.scm (vulkan-tools)[arguments]<#:phases>:
Wrap-binaries with LD_LIBRARY_PATH.

Change-Id: I9aaf1cf04f70f1da976fa84d2189ca2c01b9520f
---
 gnu/packages/vulkan.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 4c53a19aba..dcf97e98dd 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -368,7 +368,16 @@ (define-public vulkan-tools
                   (replace 'check
                     (lambda* (#:key tests? #:allow-other-keys)
                       (when tests?
-                        (invoke "./tests/vulkan_tools_tests")))))))
+                        (invoke "./tests/vulkan_tools_tests"))))
+                  (add-after 'install 'wrap-binaries
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (for-each
+                        (lambda (file)
+                          (wrap-program file
+                            `("LD_LIBRARY_PATH" ":" =
+                               (,(getenv "LIBRARY_PATH")))))
+                        (find-files (string-append (assoc-ref outputs "out")
+                                                   "/bin"))))))))
     (home-page
      "https://github.com/KhronosGroup/Vulkan-Tools")
     (synopsis "Tools and utilities for Vulkan")

base-commit: e9b25a6c6c626a560d28a1f732e6e5d362d584a4
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#71109; Package guix-patches. (Sun, 26 May 2024 18:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 71109 <at> debbugs.gnu.org (full text, mbox):

From: Kaelyn <kaelyn.alexi <at> protonmail.com>
To: "71109 <at> debbugs.gnu.org" <71109 <at> debbugs.gnu.org>
Subject: Re: [PATCH] gnu: vulkan-tools: Wrap binaries with LD_LIBRARY_PATH.
Date: Sun, 26 May 2024 18:51:01 +0000
Hi,

This patch looks good to me, and I've confirmed it fixes the issue with vulkaninfo not running.

I am curious though as to what caused vulkaninfo to need LD_LIBRARY_PATH, as before the the vulkan updates a couple of months ago (at least as of gitish 4d79a9c from early April), vulkaninfo worked fine without needing LD_LIBRARY_PATH set. The new need does have me a bit concerned that other vulkan apps which used to work may need a similar workaround to keep functioning as expected.

Cheers,
Kaelyn




Information forwarded to guix-patches <at> gnu.org:
bug#71109; Package guix-patches. (Fri, 31 May 2024 10:40:02 GMT) Full text and rfc822 format available.

Message #11 received at 71109 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sughosha <sughosha <at> disroot.org>
Cc: 71109 <at> debbugs.gnu.org, Kaelyn <kaelyn.alexi <at> protonmail.com>
Subject: Re: [bug#71109] [PATCH] gnu: vulkan-tools: Wrap binaries with
 LD_LIBRARY_PATH.
Date: Fri, 31 May 2024 12:38:53 +0200
Hi,

Sughosha <sughosha <at> disroot.org> skribis:

> This fixes not finding vulkan-loader.

Could you show how to test it?

> +                          (wrap-program file
> +                            `("LD_LIBRARY_PATH" ":" =
> +                               (,(getenv "LIBRARY_PATH")))))

This is probably a bit too broad because LIBRARY_PATH includes
build-time-only dependencies (python, gawk, binutils, bzip2, etc.).

Could we explicitly list what needs to be there instead?

Also maybe change ‘=’ to ‘suffix’ so users can still override
LD_LIBRARY_PATH.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#71109; Package guix-patches. (Fri, 31 May 2024 16:49:01 GMT) Full text and rfc822 format available.

Message #14 received at 71109 <at> debbugs.gnu.org (full text, mbox):

From: Kaelyn <kaelyn.alexi <at> protonmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 71109 <at> debbugs.gnu.org, Sughosha <sughosha <at> disroot.org>
Subject: Re: [bug#71109] [PATCH] gnu: vulkan-tools: Wrap binaries with
 LD_LIBRARY_PATH.
Date: Fri, 31 May 2024 16:47:41 +0000
Hi,

On Friday, May 31st, 2024 at 3:38 AM, Ludovic Courtès <ludo <at> gnu.org> wrote:

> 
> 
> Hi,
> 
> Sughosha sughosha <at> disroot.org skribis:
> 
> > This fixes not finding vulkan-loader.
> 
> 
> Could you show how to test it?

At least for me, the problem shows up simply with vulkan-tools installed (or using "guix shell vulkan-tools") using a guix commit after the latest (1.3.280) vulkan updates. Simply running "vulkaninfo" results in the error:

ERROR at /tmp/guix-build-vulkan-tools-1.3.280.0.drv-0/source/vulkaninfo/./vulkaninfo.h:412: Failed to initialize: Vulkan loader is not installed, not found, or failed to load.

> 
> > + (wrap-program file
> > + `("LD_LIBRARY_PATH" ":" =
> > + (,(getenv "LIBRARY_PATH")))))
> 
> 
> This is probably a bit too broad because LIBRARY_PATH includes
> build-time-only dependencies (python, gawk, binutils, bzip2, etc.).
> 
> Could we explicitly list what needs to be there instead?

A bit of local testing just now suggests setting LD_LIBRARY_PATH to the vulkan-loader package's lib dir should be enough to resolve the error.

Cheers,
Kaelyn

> Also maybe change ‘=’ to ‘suffix’ so users can still override
> LD_LIBRARY_PATH.
> 
> Thanks,
> Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#71109; Package guix-patches. (Fri, 31 May 2024 17:56:01 GMT) Full text and rfc822 format available.

Message #17 received at 71109 <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 71109 <at> debbugs.gnu.org, Kaelyn <kaelyn.alexi <at> protonmail.com>
Subject: Re: [bug#71109] [PATCH] gnu: vulkan-tools: Wrap binaries with
 LD_LIBRARY_PATH.
Date: Fri, 31 May 2024 20:51:44 +0530
On Friday, May 31, 2024 4:08:53 PM IST Ludovic Courtès wrote:
> Hi,
> 
> Sughosha <sughosha <at> disroot.org> skribis:
> > This fixes not finding vulkan-loader.
> 
> Could you show how to test it?
> 
> > +                          (wrap-program file
> > +                            `("LD_LIBRARY_PATH" ":" =
> > +                               (,(getenv "LIBRARY_PATH")))))
> 
> This is probably a bit too broad because LIBRARY_PATH includes
> build-time-only dependencies (python, gawk, binutils, bzip2, etc.).
> 
> Could we explicitly list what needs to be there instead?
> 
> Also maybe change ‘=’ to ‘suffix’ so users can still override
> LD_LIBRARY_PATH.
> 
> Thanks,
> Ludo’.
Hi,
Thanks for your review!

> Could you show how to test it?
Currently if I just run `vulkaninfo`, this error appears:
```
ERROR at /tmp/guix-build-vulkan-tools-1.3.280.0.drv-0/source/vulkaninfo/./
vulkaninfo.h:412: Failed to initialize: Vulkan loader is not installed, not 
found, or failed to load.
```
I don't know if something should be patched before building itself.
But if I run: `LD_LIBRARY_PATH=$(guix build vulkan-loader)/lib vulkaninfo`, 
the program will be executed without any error.

> This is probably a bit too broad because LIBRARY_PATH includes
> build-time-only dependencies (python, gawk, binutils, bzip2, etc.).
If I wrap only with vulkan-loader's library path also, it works. But would it 
be a "right" way of wrapping a program.

> Also maybe change ‘=’ to ‘suffix’ so users can still override
Yes, you are right. I will change it.

-- 
Sughosha






Information forwarded to guix-patches <at> gnu.org:
bug#71109; Package guix-patches. (Sun, 02 Jun 2024 01:20:01 GMT) Full text and rfc822 format available.

Message #20 received at 71109 <at> debbugs.gnu.org (full text, mbox):

From: nathan <nathan_mail <at> nborghese.com>
To: sughosha <at> disroot.org, 71109 <at> debbugs.gnu.org
Subject: [bug#71109] [PATCH] gnu: vulkan-tools: Wrap binaries with
 LD_LIBRARY_PATH.
Date: Sun, 2 Jun 2024 01:19:14 +0000
[Message part 1 (text/plain, inline)]
commit e156996c478a8e5d040ccf199437bcdbdbab63ed in vulkan-tools makes it 
use volk to load vulkan instead of a bunch of custom code in the repo.
volk uses dlopen("libvulkan.so.1").
i dont remember volk ever working, so this just propagated the bug to 
another program.
attached is a patch to hard-code the libvulkan.so path into volk.

vulkan-headers also has dlopen for libvulkan.so.
i dont know which programs use it, but next time we have to rebuild 
everything we may as well patch it.
i attached a patch that shows how to do it.
[0001-example-of-how-to-patch-patch-of-vulkan-loader-into-.patch (text/x-patch, attachment)]
[0001-gnu-volk-Hard-code-path-of-vulkan-loader-for-dynamic.patch (text/x-patch, attachment)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 11 Jun 2024 21:31:02 GMT) Full text and rfc822 format available.

Notification sent to Sughosha <sughosha <at> disroot.org>:
bug acknowledged by developer. (Tue, 11 Jun 2024 21:31:02 GMT) Full text and rfc822 format available.

Message #25 received at 71109-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: nathan <nathan_mail <at> nborghese.com>
Cc: 71109-done <at> debbugs.gnu.org, sughosha <at> disroot.org
Subject: Re: [bug#71109] [PATCH] gnu: vulkan-tools: Wrap binaries with
 LD_LIBRARY_PATH.
Date: Tue, 11 Jun 2024 23:27:43 +0200
Hi nathan and all,

nathan <nathan_mail <at> nborghese.com> skribis:

> From 811d7567098e00711ee4c9c80afbe544ebe1c08e Mon Sep 17 00:00:00 2001
> Message-ID: <811d7567098e00711ee4c9c80afbe544ebe1c08e.1717290934.git.nathan_mail <at> nborghese.com>
> From: nathan <nathan_mail <at> nborghese.com>
> Date: Sat, 1 Jun 2024 21:14:13 -0400
> Subject: [PATCH] example of how to patch patch of vulkan-loader into
>  vulkan-headers
>
> Change-Id: Ic674a4d965d8049e388d75137111ed0253ca3b18

[...]

> From ee4581690b6486a65bf0e4faed3f2c88cac70d9e Mon Sep 17 00:00:00 2001
> Message-ID: <ee4581690b6486a65bf0e4faed3f2c88cac70d9e.1717286310.git.nathan_mail <at> nborghese.com>
> From: nathan <nathan_mail <at> nborghese.com>
> Date: Sat, 1 Jun 2024 19:55:24 -0400
> Subject: [PATCH] gnu: volk: Hard-code path of vulkan-loader for dynamic
>  loading
>
> * gnu/packages/vulkan.scm (volk):
> [arguments]: use gexp.
> <#:phases>: patch dlopen with libvulkan.so. fixes vulkan-tools and potentially
> other programs too.
> [input]: add vulkan-loader
>
> Change-Id: I5ef0eb13d35e517b8947faddace641882a775b80

These two patches make sense to me.

I applied them with minor tweaks: using ‘search-input-file’ rather than
‘assoc-ref’ in build phases, and commit log modifications to match our
conventions.

Thank you!

Ludo’.




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 11 Jun 2024 21:59:01 GMT) Full text and rfc822 format available.

Removed tag(s) patch. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 11 Jun 2024 21:59:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#71109; Package guix-patches. (Tue, 11 Jun 2024 22:03:02 GMT) Full text and rfc822 format available.

Message #32 received at 71109 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: nathan <nathan_mail <at> nborghese.com>
Cc: John Kehayias <john.kehayias <at> protonmail.com>, 71109 <at> debbugs.gnu.org,
 sughosha <at> disroot.org
Subject: Re: [bug#71109] [PATCH] gnu: vulkan-tools: Wrap binaries with
 LD_LIBRARY_PATH.
Date: Wed, 12 Jun 2024 00:02:14 +0200
[Message part 1 (text/plain, inline)]
Hi,

I spoke a bit too fast: given that many packages depend on
‘vulkan-headers’, this should be applied on a branch.

Attached as the updated patches.

John, could you apply them on the ‘mesa-updates’ branch?  (I realized
there’s no formal ‘mesa’ team contrary to what I thought; perhaps there
should be one?).

Thanks,
Ludo’.

[0001-gnu-vulkan-headers-Hard-code-libvulkan.so-file-name.patch (text/x-patch, inline)]
From 577a58ac4d23e7fa749fddb3007a3ad14c40f38d Mon Sep 17 00:00:00 2001
Message-ID: <577a58ac4d23e7fa749fddb3007a3ad14c40f38d.1718143100.git.ludo <at> gnu.org>
From: nathan <nathan_mail <at> nborghese.com>
Date: Sat, 1 Jun 2024 21:14:13 -0400
Subject: [PATCH 1/2] gnu: vulkan-headers: Hard-code libvulkan.so file name.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/vulkan.scm (vulkan-headers): Rename to…
(vulkan-headers/no-loader): … this.
(vulkan-headers): New variable.
(vulkan-loader): Depend on ‘vulkan-headers/no-loader’.

Change-Id: Ic674a4d965d8049e388d75137111ed0253ca3b18
Co-authored-by: Ludovic Courtès <ludo <at> gnu.org>
---
 gnu/packages/vulkan.scm | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 25542c1e064..5ff47be92e2 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -246,7 +246,8 @@ (define-public glslang
                    ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
                    license:asl2.0))))
 
-(define-public vulkan-headers
+;; vulkan-headers, but without the path to vulkan-loader patched in.
+(define-public vulkan-headers/no-loader
   (package
     (name "vulkan-headers")
     (version "1.3.280.0")
@@ -263,6 +264,7 @@ (define-public vulkan-headers
     (build-system cmake-build-system)
     (arguments
      `(#:tests? #f))                    ; No tests.
+    (properties '((hidden? . #t)))
     (home-page
      "https://github.com/KhronosGroup/Vulkan-Headers")
     (synopsis "Vulkan Header files and API registry")
@@ -270,6 +272,25 @@ (define-public vulkan-headers
      "Vulkan-Headers contains header files and API registry for Vulkan.")
     (license (list license:asl2.0)))) ;LICENSE.txt
 
+(define-public vulkan-headers
+  (package
+    (inherit vulkan-headers/no-loader)
+    (arguments
+     (substitute-keyword-arguments (package-arguments vulkan-headers/no-loader)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-after 'unpack 'patch-libvulkan-file-name
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "include/vulkan/vulkan.hpp"
+                  (("dlopen\\( \"libvulkan.so")
+                   (string-append "dlopen(\""
+                                  (search-input-file
+                                   inputs "/lib/libvulkan.so"))))))))))
+    (inputs
+     (modify-inputs (package-inputs vulkan-headers/no-loader)
+       (prepend vulkan-loader)))
+    (properties '())))
+
 (define-public vulkan-loader
   (package
     (name "vulkan-loader")
@@ -326,7 +347,7 @@ (define-public vulkan-loader
            python
            wayland))
     (inputs
-     (list vulkan-headers libxrandr))
+     (list vulkan-headers/no-loader libxrandr))
     (native-search-paths
      (list (search-path-specification
             (variable "XDG_DATA_DIRS")

base-commit: 7daf9328921f9f7d4fe4839d8e16091bd9f06072
-- 
2.45.1

[0002-gnu-volk-Hard-code-path-of-vulkan-loader-for-dynamic.patch (text/x-patch, inline)]
From 2cb9899209d1807cd18e9ed68a634faca48c6d89 Mon Sep 17 00:00:00 2001
Message-ID: <2cb9899209d1807cd18e9ed68a634faca48c6d89.1718143100.git.ludo <at> gnu.org>
In-Reply-To: <577a58ac4d23e7fa749fddb3007a3ad14c40f38d.1718143100.git.ludo <at> gnu.org>
References: <577a58ac4d23e7fa749fddb3007a3ad14c40f38d.1718143100.git.ludo <at> gnu.org>
From: nathan <nathan_mail <at> nborghese.com>
Date: Sat, 1 Jun 2024 19:55:24 -0400
Subject: [PATCH 2/2] gnu: volk: Hard-code path of vulkan-loader for dynamic
 loading
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Until now, we’d get:

  $ guix shell vulkan-tools -- vulkaninfo
  ERROR at /tmp/guix-build-vulkan-tools-1.3.280.0.drv-0/source/vulkaninfo/./vulkaninfo.h:412: Failed to initialize: Vulkan loader is not installed, not found, or failed to load.

This patch fixes it and potentially for other programs as well.

* gnu/packages/vulkan.scm (volk)[arguments]: use gexp.
<#:phases>: Patch dlopen with libvulkan.so.
[input]: Add vulkan-loader.

Change-Id: I5ef0eb13d35e517b8947faddace641882a775b80
Co-authored-by: Ludovic Courtès <ludo <at> gnu.org>
---
 gnu/packages/vulkan.scm | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 5ff47be92e2..5d322f3ddb9 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -597,9 +597,19 @@ (define-public volk
                 "0x4jhc8n9c4k8svmmcaxxs613xbsav7wam94gacddlm738cwp13v"))))
     (build-system cmake-build-system)
     (arguments
-     '(#:tests? #f                      ;no test
-       #:configure-flags '("-DVOLK_INSTALL=ON" "-DVOLK_PULL_IN_VULKAN=ON")))
-    (inputs (list vulkan-headers))
+     (list
+      #:tests? #f                      ;no test
+      #:configure-flags #~(list "-DVOLK_INSTALL=ON" "-DVOLK_PULL_IN_VULKAN=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-loader-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "volk.c"
+                (("dlopen\\(\"libvulkan.so")
+                 (string-append "dlopen(\""
+                                (search-input-file
+                                 inputs "/lib/libvulkan.so")))))))))
+    (inputs (list vulkan-headers vulkan-loader))
     (synopsis "Meta loader for Vulkan API")
     (description
      "Volk is a meta-loader for Vulkan.  It allows you to dynamically load
-- 
2.45.1


Reply sent to John Kehayias <john.kehayias <at> protonmail.com>:
You have taken responsibility. (Sat, 07 Sep 2024 01:33:02 GMT) Full text and rfc822 format available.

Notification sent to Sughosha <sughosha <at> disroot.org>:
bug acknowledged by developer. (Sat, 07 Sep 2024 01:33:02 GMT) Full text and rfc822 format available.

Message #37 received at 71109-done <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: nathan <nathan_mail <at> nborghese.com>, 71109-done <at> debbugs.gnu.org,
 sughosha <at> disroot.org
Subject: Re: [bug#71109] [PATCH] gnu: vulkan-tools: Wrap binaries with
 LD_LIBRARY_PATH.
Date: Sat, 07 Sep 2024 01:32:04 +0000
Hi all,

On Wed, Jun 12, 2024 at 12:02 AM, Ludovic Courtès wrote:

> Hi,
>
> I spoke a bit too fast: given that many packages depend on
> ‘vulkan-headers’, this should be applied on a branch.
>
> Attached as the updated patches.
>
> John, could you apply them on the ‘mesa-updates’ branch?  (I realized
> there’s no formal ‘mesa’ team contrary to what I thought; perhaps there
> should be one?).
>
> Thanks,
> Ludo’.
>

My apologies for a being a bit slow here! I've included these patches on
mesa-updates (building now) and the full set of patches is tracked here:
https://issues.guix.gnu.org/73071  I have used vulkan on that branch
without issues so far.

And yes, I keep forgetting to make a formal team. I suppose it shouldn't
be a "mesa" team but a bit broader (graphics?).

I will close this as it is live on mesa-updates and hopefully merged
into master before long. (Otherwise I'm afraid it will be forgotten open
and it can be tested with the other updates, but please correct me if
this should remain open.)

Thanks everyone for your work here!
John

>>From 577a58ac4d23e7fa749fddb3007a3ad14c40f38d Mon Sep 17 00:00:00 2001
> Message-ID: <577a58ac4d23e7fa749fddb3007a3ad14c40f38d.1718143100.git.ludo <at> gnu.org>
> From: nathan <nathan_mail <at> nborghese.com>
> Date: Sat, 1 Jun 2024 21:14:13 -0400
> Subject: [PATCH 1/2] gnu: vulkan-headers: Hard-code libvulkan.so file name.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> * gnu/packages/vulkan.scm (vulkan-headers): Rename to…
> (vulkan-headers/no-loader): … this.
> (vulkan-headers): New variable.
> (vulkan-loader): Depend on ‘vulkan-headers/no-loader’.
>
> Change-Id: Ic674a4d965d8049e388d75137111ed0253ca3b18
> Co-authored-by: Ludovic Courtès <ludo <at> gnu.org>
> ---
>  gnu/packages/vulkan.scm | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
> index 25542c1e064..5ff47be92e2 100644
> --- a/gnu/packages/vulkan.scm
> +++ b/gnu/packages/vulkan.scm
> @@ -246,7 +246,8 @@ (define-public glslang
>                     ;; include/SPIRV/{bitutils,hex_float}.h are Apache 2.0.
>                     license:asl2.0))))
>
> -(define-public vulkan-headers
> +;; vulkan-headers, but without the path to vulkan-loader patched in.
> +(define-public vulkan-headers/no-loader
>    (package
>      (name "vulkan-headers")
>      (version "1.3.280.0")
> @@ -263,6 +264,7 @@ (define-public vulkan-headers
>      (build-system cmake-build-system)
>      (arguments
>       `(#:tests? #f))                    ; No tests.
> +    (properties '((hidden? . #t)))
>      (home-page
>       "https://github.com/KhronosGroup/Vulkan-Headers")
>      (synopsis "Vulkan Header files and API registry")
> @@ -270,6 +272,25 @@ (define-public vulkan-headers
>       "Vulkan-Headers contains header files and API registry for Vulkan.")
>      (license (list license:asl2.0)))) ;LICENSE.txt
>
> +(define-public vulkan-headers
> +  (package
> +    (inherit vulkan-headers/no-loader)
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments vulkan-headers/no-loader)
> +       ((#:phases phases #~%standard-phases)
> +        #~(modify-phases #$phases
> +            (add-after 'unpack 'patch-libvulkan-file-name
> +              (lambda* (#:key inputs #:allow-other-keys)
> +                (substitute* "include/vulkan/vulkan.hpp"
> +                  (("dlopen\\( \"libvulkan.so")
> +                   (string-append "dlopen(\""
> +                                  (search-input-file
> +                                   inputs "/lib/libvulkan.so"))))))))))
> +    (inputs
> +     (modify-inputs (package-inputs vulkan-headers/no-loader)
> +       (prepend vulkan-loader)))
> +    (properties '())))
> +
>  (define-public vulkan-loader
>    (package
>      (name "vulkan-loader")
> @@ -326,7 +347,7 @@ (define-public vulkan-loader
>             python
>             wayland))
>      (inputs
> -     (list vulkan-headers libxrandr))
> +     (list vulkan-headers/no-loader libxrandr))
>      (native-search-paths
>       (list (search-path-specification
>              (variable "XDG_DATA_DIRS")
>
> base-commit: 7daf9328921f9f7d4fe4839d8e16091bd9f06072
> --
> 2.45.1
>
>>From 2cb9899209d1807cd18e9ed68a634faca48c6d89 Mon Sep 17 00:00:00 2001
> Message-ID: <2cb9899209d1807cd18e9ed68a634faca48c6d89.1718143100.git.ludo <at> gnu.org>
> In-Reply-To: <577a58ac4d23e7fa749fddb3007a3ad14c40f38d.1718143100.git.ludo <at> gnu.org>
> References: <577a58ac4d23e7fa749fddb3007a3ad14c40f38d.1718143100.git.ludo <at> gnu.org>
> From: nathan <nathan_mail <at> nborghese.com>
> Date: Sat, 1 Jun 2024 19:55:24 -0400
> Subject: [PATCH 2/2] gnu: volk: Hard-code path of vulkan-loader for dynamic
>  loading
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Until now, we’d get:
>
>   $ guix shell vulkan-tools -- vulkaninfo
>   ERROR at /tmp/guix-build-vulkan-tools-1.3.280.0.drv-0/source/vulkaninfo/./vulkaninfo.h:412: Failed to initialize: Vulkan loader is not installed, not found, or failed to load.
>
> This patch fixes it and potentially for other programs as well.
>
> * gnu/packages/vulkan.scm (volk)[arguments]: use gexp.
> <#:phases>: Patch dlopen with libvulkan.so.
> [input]: Add vulkan-loader.
>
> Change-Id: I5ef0eb13d35e517b8947faddace641882a775b80
> Co-authored-by: Ludovic Courtès <ludo <at> gnu.org>
> ---
>  gnu/packages/vulkan.scm | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
> index 5ff47be92e2..5d322f3ddb9 100644
> --- a/gnu/packages/vulkan.scm
> +++ b/gnu/packages/vulkan.scm
> @@ -597,9 +597,19 @@ (define-public volk
>                  "0x4jhc8n9c4k8svmmcaxxs613xbsav7wam94gacddlm738cwp13v"))))
>      (build-system cmake-build-system)
>      (arguments
> -     '(#:tests? #f                      ;no test
> -       #:configure-flags '("-DVOLK_INSTALL=ON" "-DVOLK_PULL_IN_VULKAN=ON")))
> -    (inputs (list vulkan-headers))
> +     (list
> +      #:tests? #f                      ;no test
> +      #:configure-flags #~(list "-DVOLK_INSTALL=ON" "-DVOLK_PULL_IN_VULKAN=ON")
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-after 'unpack 'patch-loader-path
> +            (lambda* (#:key inputs #:allow-other-keys)
> +              (substitute* "volk.c"
> +                (("dlopen\\(\"libvulkan.so")
> +                 (string-append "dlopen(\""
> +                                (search-input-file
> +                                 inputs "/lib/libvulkan.so")))))))))
> +    (inputs (list vulkan-headers vulkan-loader))
>      (synopsis "Meta loader for Vulkan API")
>      (description
>       "Volk is a meta-loader for Vulkan.  It allows you to dynamically load





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 05 Oct 2024 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 159 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.