[PATCH core-updates-frozen] fix mesa-opencl and mesa-opencl-icd build failure

  • Done
  • quality assurance status badge
Details
2 participants
  • John Kehayias
  • Ludovic Courtès
Owner
unassigned
Submitted by
John Kehayias
Severity
normal
J
J
John Kehayias wrote on 31 Jul 2021 20:08
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
vEPkkPmJcvnI97GxFJybopbmrou4Z2wNrA3gmxLXOAJzdBxLWi--WmJRXFWVLAL1j65B_sbmIWR-wSFZ1heZgHknsLpDu8ALQX0rKTrK-wY=@protonmail.com
Hello,

Attached is a patch to fix failures for mesa-opencl and mesa-opencl-icd building with the update to 21.1.6 for Mesa. This is from upstream, a change in meson.build that removed LLVM targets (for CMake users it seems) but then breaks compilation for us on a shared library LLVM build.




The patch restores 'all-targets' to llvm_modules and successfully builds. Apologies about the long line and I'm still guessing at some of the scheme patching code. Since Mesa takes a while to build I didn't want to go through many iterations to get the code cleaner. Please feel free to make it better, and I would think mesa-opencl-icu should be able to inherit the patch from mesa-opencl, but I didn't try to do that.

Thanks,
John
From 92744e9f54db9931253e17245d2c3841c6ac6369 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Sat, 31 Jul 2021 13:57:37 -0400
Subject: [PATCH] gnu: mesa: fix mesa-opencl and mesa-opencl-icd 21.1.6

* gnu/packages/gl.scm (mesa-opencl): Restore LLVM targets to meson.build
* gnu/packages/gl.scm (mesa-opencl-icd): Restore LLVM targets to meson.build
---
gnu/packages/gl.scm | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

Toggle diff (38 lines)
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index e316352377..cdd98dd8fd 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -474,7 +474,16 @@ from software emulation to complete hardware acceleration for modern GPUs.")
(arguments
(substitute-keyword-arguments (package-arguments mesa)
((#:configure-flags flags)
- `(cons "-Dgallium-opencl=standalone" ,flags))))
+ `(cons "-Dgallium-opencl=standalone" ,flags))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'enable-llvm-platforms
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Restore all LLVM targets in order to build with our LLVM
+ ;; as a shared library.
+ (substitute* "meson.build"
+ (("'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',")
+ "'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',"))))))))
(inputs
`(("libclc" ,libclc)
,@(package-inputs mesa)))
@@ -492,6 +501,13 @@ from software emulation to complete hardware acceleration for modern GPUs.")
,(delete "-Dgallium-opencl=standalone" flags)))
((#:phases phases)
`(modify-phases ,phases
+ (add-after 'unpack 'enable-llvm-platforms
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Restore all LLVM targets in order to build with our LLVM
+ ;; as a shared library.
+ (substitute* "meson.build"
+ (("'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',")
+ "'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',"))))
(add-after 'install 'mesa-icd-absolute-path
(lambda _
;; Use absolute path for OpenCL platform library.
--
2.32.0
L
L
Ludovic Courtès wrote on 3 Aug 2021 19:49
(name . John Kehayias)(address . john.kehayias@protonmail.com)(address . 49794-done@debbugs.gnu.org)
87tuk6s9je.fsf@gnu.org
Hi John,

John Kehayias <john.kehayias@protonmail.com> skribis:

Toggle quote (10 lines)
> Attached is a patch to fix failures for mesa-opencl and mesa-opencl-icd building with the update to 21.1.6 for Mesa. This is from upstream, a change in meson.build that removed LLVM targets (for CMake users it seems) but then breaks compilation for us on a shared library LLVM build.
>
> https://gitlab.freedesktop.org/mesa/mesa/-/issues/4443
>
> https://gitlab.freedesktop.org/mesa/mesa/-/issues/4302
>
> And the commit that changed it: https://gitlab.freedesktop.org/mesa/mesa/-/commit/80817b6e344258ac9b955f824ebf9019a0fc1610
>
> The patch restores 'all-targets' to llvm_modules and successfully builds. Apologies about the long line and I'm still guessing at some of the scheme patching code. Since Mesa takes a while to build I didn't want to go through many iterations to get the code cleaner. Please feel free to make it better, and I would think mesa-opencl-icu should be able to inherit the patch from mesa-opencl, but I didn't try to do that.

[...]

Toggle quote (10 lines)
> + ((#:phases phases)
> + `(modify-phases ,phases
> + (add-after 'unpack 'enable-llvm-platforms
> + (lambda* (#:key inputs #:allow-other-keys)
> + ;; Restore all LLVM targets in order to build with our LLVM
> + ;; as a shared library.
> + (substitute* "meson.build"
> + (("'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',")
> + "'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',"))))))))

I feel this is easier to follow when expressed as a good old patch, so I
took the liberty to do that and pushed it as
1685128e6e1147049feddee617a616ce7f3592c0.

Let me know if anything’s amiss.

Thanks!

Ludo’.
Closed
J
J
John Kehayias wrote on 3 Aug 2021 20:04
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 49794-done@debbugs.gnu.org)
TrTvOg8reaV_any6TmJCvqWNlF1reeqhqogO4njlIY6wGSK3FmUl1VKd5fwDSVn1dD6C7i3J20iH6rL0ZBXssxrEW3hLpPnK6cy9YBka-lY=@protonmail.com
Hi Ludo’,

On Tuesday, August 3rd, 2021 at 1:49 PM, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (9 lines)
> I feel this is easier to follow when expressed as a good old patch, so I
>
> took the liberty to do that and pushed it as
>
> 1685128e6e1147049feddee617a616ce7f3592c0.
>
> Let me know if anything’s amiss.
>

Looks good to me, thanks! I'll check in on Cuirass later to confirm the 2 mesa-opencl packages built, and report back if something has gone wrong.

Slowly but surely to getting core-updates-frozen done...

John
Closed
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 49794
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