GNU bug report logs - #72409
[PATCH] gnu: llvm: Fix misc errors for unsupported targets.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Thu, 1 Aug 2024 13:46:01 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

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 72409 in the body.
You can then email your comments to 72409 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#72409; Package guix-patches. (Thu, 01 Aug 2024 13:46:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 01 Aug 2024 13:46:02 GMT) Full text and rfc822 format available.

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

From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: llvm: Fix misc errors for unsupported targets.
Date: Thu,  1 Aug 2024 14:44:45 +0100
* gnu/packages/llvm.scm (system->llvm-target-arch): Return #f for unknown
targets.
(llvm-15, llvm-14): Handle system->llvm-target-arch and raise a
package-unsupported-target-error condition.

Change-Id: I647f721a64a39bb34196998b7e4adda3a25f1ab3
---
 gnu/packages/llvm.scm | 49 +++++++++++++++++++++++++++----------------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 2614a403c1..0c0ec1bca1 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -78,6 +78,8 @@ (define-module (gnu packages llvm)
   #:use-module (gnu packages vulkan)
   #:use-module (gnu packages xml)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
             system->llvm-target))
@@ -107,8 +109,7 @@ (define* (system->llvm-target-arch #:optional
                               (if (string-prefix? system-prefix system)
                                   target
                                   (matches rest ...)))
-                             ((_)
-                              (error "LLVM target arch for system is unknown" system)))))
+                             ((_) #f))))
     (matches ("aarch64"     => "AArch64")
              ("armhf"       => "ARM")
              ("mips64el"    => "Mips")
@@ -591,15 +592,21 @@ (define-public llvm-15
          ;; These options are required for cross-compiling LLVM according
          ;; to <https://llvm.org/docs/HowToCrossCompileLLVM.html>.
          #$@(if (%current-target-system)
-                #~((string-append "-DLLVM_TABLEGEN="
+                (or (and=>
+                     (system->llvm-target-arch)
+                     (lambda (llvm-target-arch)
+                       #~((string-append "-DLLVM_TABLEGEN="
                                   #+(file-append this-package
                                                  "/bin/llvm-tblgen"))
-                   #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
-                                    (%current-target-system))
-                   #$(string-append "-DLLVM_TARGET_ARCH="
-                                    (system->llvm-target-arch))
-                   #$(string-append "-DLLVM_TARGETS_TO_BUILD="
-                                    (system->llvm-target)))
+                          #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
+                                           (%current-target-system))
+                          #$(string-append "-DLLVM_TARGET_ARCH=" llvm-target-arch)
+                          #$(string-append "-DLLVM_TARGETS_TO_BUILD="
+                                           (system->llvm-target)))))
+                    (raise (condition
+                            (&package-unsupported-target-error
+                             (package this-package)
+                             (target (%current-target-system))))))
                 '())
          ;; Note: sadly, the build system refuses the use of
          ;; -DBUILD_SHARED_LIBS=ON and the large static archives are needed to
@@ -651,15 +658,21 @@ (define-public llvm-14
          ;; These options are required for cross-compiling LLVM according
          ;; to <https://llvm.org/docs/HowToCrossCompileLLVM.html>.
          #$@(if (%current-target-system)
-                #~((string-append "-DLLVM_TABLEGEN="
-                                  #+(file-append this-package
-                                                 "/bin/llvm-tblgen"))
-                   #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
-                                    (%current-target-system))
-                   #$(string-append "-DLLVM_TARGET_ARCH="
-                                    (system->llvm-target-arch))
-                   #$(string-append "-DLLVM_TARGETS_TO_BUILD="
-                                    (system->llvm-target)))
+                (or (and=>
+                     (system->llvm-target-arch)
+                     (lambda (llvm-target-arch)
+                       #~((string-append "-DLLVM_TABLEGEN="
+                                         #+(file-append this-package
+                                                        "/bin/llvm-tblgen"))
+                          #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
+                                           (%current-target-system))
+                          #$(string-append "-DLLVM_TARGET_ARCH=" llvm-target-arch)
+                          #$(string-append "-DLLVM_TARGETS_TO_BUILD="
+                                           (system->llvm-target)))))
+                    (raise (condition
+                            (&package-unsupported-target-error
+                             (package this-package)
+                             (target (%current-target-system))))))
                 '())
          ;; undefined reference to `__atomic_fetch_add_8' in lib/libLLVMOrcJIT.so.14
          #$@(if (target-ppc32?)

base-commit: 56d3d04a442b52097e523dcfebf60ff5bf82bcfd
-- 
2.45.2





Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Sun, 11 Aug 2024 10:35:03 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Sun, 11 Aug 2024 10:35:03 GMT) Full text and rfc822 format available.

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

From: Christopher Baines <mail <at> cbaines.net>
To: 72409-done <at> debbugs.gnu.org
Subject: Re: [bug#72409] [PATCH] gnu: llvm: Fix misc errors for unsupported
 targets.
Date: Sun, 11 Aug 2024 11:34:06 +0100
[Message part 1 (text/plain, inline)]
Christopher Baines <mail <at> cbaines.net> writes:

> * gnu/packages/llvm.scm (system->llvm-target-arch): Return #f for unknown
> targets.
> (llvm-15, llvm-14): Handle system->llvm-target-arch and raise a
> package-unsupported-target-error condition.
>
> Change-Id: I647f721a64a39bb34196998b7e4adda3a25f1ab3
> ---
>  gnu/packages/llvm.scm | 49 +++++++++++++++++++++++++++----------------
>  1 file changed, 31 insertions(+), 18 deletions(-)

Pushed to master as 5f0dcf22a384af08f1e7d5aafff340f3f808b55b.

Chris
[signature.asc (application/pgp-signature, inline)]

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

This bug report was last modified 281 days ago.

Previous Next


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