[PATCH] gnu: mesa-opencl-icd: Use absolute path for the library.

  • Done
  • quality assurance status badge
Details
2 participants
  • Guillaume Le Vaillant
  • Ivan Gankevich
Owner
unassigned
Submitted by
Ivan Gankevich
Severity
normal

Debbugs page

Ivan Gankevich wrote 4 years ago
(address . guix-patches@gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210724100127.8034-1-i.gankevich@spbu.ru
* gnu/packages/gl.scm (mesa-opencl-icd): Use absolute path for OpenCL
platform library in "mesa.icd" file. With this patch setting
LD_LIBRARY_PATH=$LIBRARY_PATH is no longer needed to run OpenCL
applications.
---
gnu/packages/gl.scm | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)

Toggle diff (37 lines)
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index c14e7c0d53..f693efb36b 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -475,10 +475,26 @@ from software emulation to complete hardware acceleration for modern GPUs.")
(package/inherit mesa-opencl
(name "mesa-opencl-icd")
(arguments
- (substitute-keyword-arguments (package-arguments mesa)
- ((#:configure-flags flags)
- `(cons "-Dgallium-opencl=icd"
- ,(delete "-Dgallium-opencl=standalone" flags)))))))
+ (substitute-keyword-arguments (package-arguments mesa)
+ ((#:configure-flags flags)
+ `(cons "-Dgallium-opencl=icd"
+ ,(delete "-Dgallium-opencl=standalone" flags)))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'install 'mesa-icd-absolute-path
+ (lambda _
+ ;; Use absolute path for OpenCL platform library.
+ ;; Otherwise we would have to set LD_LIBRARY_PATH=LIBRARY_PATH
+ ;; for ICD in our applications to find OpenCL platform.
+ (use-modules (guix build utils)
+ (ice-9 textual-ports))
+ (let* ((out (assoc-ref %outputs "out"))
+ (mesa-icd (string-append out "/etc/OpenCL/vendors/mesa.icd"))
+ (old-path (call-with-input-file mesa-icd get-string-all))
+ (new-path (string-append out "/lib/" (string-trim-both old-path))))
+ (if (file-exists? new-path)
+ (call-with-output-file mesa-icd
+ (lambda (port) (format port "~a\n" new-path)))))))))))))
(define-public mesa-headers
(package/inherit mesa
--
2.32.0
Guillaume Le Vaillant wrote 4 years ago
(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)(address . 49717-done@debbugs.gnu.org)
87wnpbww05.fsf@kitej
I added a copyright line and pushed the patch as
8cfd9ef831caff790c837eca87b1164801459108.
Thanks.
-----BEGIN PGP SIGNATURE-----

iIUEAREKAC0WIQTLxZxm7Ce5cXlAaz5r6CCK3yH+PwUCYQA2+g8cZ2x2QHBvc3Rl
by5uZXQACgkQa+ggit8h/j+H8wD/XyWiITM7TdfBhKj/z6/WB2mYHp3P52f9bj5+
Xm7C7noA/2qrCJRqI1yQVM+8F1TWmHrQ5L6vJz2KETzlbxQm6Ajm
=gYLU
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 49717@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 49717
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help