From patchwork Thu Aug 1 13:44:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 66599 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0DCF927BBEA; Thu, 1 Aug 2024 14:46:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 52D5A27BBE2 for ; Thu, 1 Aug 2024 14:46:07 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZW7q-0005Vt-M2; Thu, 01 Aug 2024 09:45:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZW7m-0005VN-2P for guix-patches@gnu.org; Thu, 01 Aug 2024 09:45:47 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sZW7l-0006uz-3k for guix-patches@gnu.org; Thu, 01 Aug 2024 09:45:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=DgD+y4gdKl4tAYkVXPGs6/34cI5j++aFXTxLr8aGCHw=; b=tDxH6UZCf/5wvIdo6GDmMNluWkEqUc87r1u03UVFBLeVTdnMefCrBJF/Uo+WRRfq4xGkNyb3m3qupb6FrBe9xoM8ZpjT60nsHnUWMmKthQ6efcqz71FWG2YR1G1Y7mIg62Z6SACLcphAy9Br8aft8OP2/0js3w/jV2U6L/SqowvCp1s/jmxFsUGyNvUufKVw+p4pP0QIHHa6xs/u3rmf6Nrqi4URN/W0AVEB6wyubhWj4YoKlhrQfJWm2/S7ikLUv4agyd++YdsvDQ0EzLHA7I/P8oBvnyEUF3L2MjhNq7DM+ZhAYRwpa1Eag3EZdE9FYbO+hhajyVvkDmSTWEd3NA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sZW81-0004nO-VC for guix-patches@gnu.org; Thu, 01 Aug 2024 09:46:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72409] [PATCH] gnu: llvm: Fix misc errors for unsupported targets. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 01 Aug 2024 13:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72409 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72409@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172251991518374 (code B ref -1); Thu, 01 Aug 2024 13:46:01 +0000 Received: (at submit) by debbugs.gnu.org; 1 Aug 2024 13:45:15 +0000 Received: from localhost ([127.0.0.1]:51064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sZW7H-0004mI-9H for submit@debbugs.gnu.org; Thu, 01 Aug 2024 09:45:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:57542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sZW7E-0004m8-Pv for submit@debbugs.gnu.org; Thu, 01 Aug 2024 09:45:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZW6x-0005LG-JW for guix-patches@gnu.org; Thu, 01 Aug 2024 09:44:55 -0400 Received: from mira.cbaines.net ([212.71.252.8]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZW6u-0006h3-Rq for guix-patches@gnu.org; Thu, 01 Aug 2024 09:44:54 -0400 Received: from localhost (unknown [212.132.255.81]) by mira.cbaines.net (Postfix) with ESMTPSA id 0958527BBE2 for ; Thu, 1 Aug 2024 14:44:48 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 6c00bca1 for ; Thu, 1 Aug 2024 13:44:46 +0000 (UTC) From: Christopher Baines Date: Thu, 1 Aug 2024 14:44:45 +0100 Message-ID: <0e25963b235b36407c0e7f7b0ef77b02ba6029fe.1722519885.git.mail@cbaines.net> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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(-) base-commit: 56d3d04a442b52097e523dcfebf60ff5bf82bcfd 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 . #$@(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 . #$@(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?)