* [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile.
@ 2023-03-25 12:13 Z572 via Guix-patches via
2023-04-03 11:11 ` 宋文武 via Guix-patches via
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Z572 via Guix-patches via @ 2023-03-25 12:13 UTC (permalink / raw)
To: 62438
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2611 bytes --]
* gnu/packages/llvm.scm: (llvm-15 llvm-14 llvm-12): fix riscv64 cross-compile
[arguments]: <#:configure>: when target is riscv64, set -DLLVM_TARGET_ARCH=RISCV64.
---
gnu/packages/llvm.scm | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index e5bf9f5cae..f8691414d8 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -26,6 +26,7 @@
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
+;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -598,7 +599,9 @@ (define-public llvm-15
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (if (target-riscv64?)
+ "RISCV64"
+ (system->llvm-target)))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
'())
@@ -658,7 +661,9 @@ (define-public llvm-14
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (if (target-riscv64?)
+ "RISCV64"
+ (system->llvm-target)))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
'())
@@ -910,7 +915,9 @@ (define-public llvm-12
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (if (target-riscv64?)
+ "RISCV64"
+ (system->llvm-target)))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
#~())
--
2.39.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile.
2023-03-25 12:13 [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile Z572 via Guix-patches via
@ 2023-04-03 11:11 ` 宋文武 via Guix-patches via
[not found] ` <87v8idq9wf.fsf_-_@qq.com>
2023-04-08 5:32 ` [bug#62438] [PATCH] gnu: llvm: Fix riscv64 cross-compilation Z572 via Guix-patches via
2023-09-07 10:42 ` [bug#62438] [PATCH v2] gnu: llvm: Fix riscv64 cross-compilation iyzsong--- via Guix-patches via
2 siblings, 1 reply; 9+ messages in thread
From: 宋文武 via Guix-patches via @ 2023-04-03 11:11 UTC (permalink / raw)
To: Z572; +Cc: 62438
Z572 <873216071@qq.com> writes:
> - (system->llvm-target))
> + (if (target-riscv64?)
> + "RISCV64"
> + (system->llvm-target)))
> #$(string-append "-DLLVM_TARGETS_TO_BUILD="
> (system->llvm-target)))
> '())
> @@ -658,7 +661,9 @@ (define-public llvm-14
> #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
> (%current-target-system))
> #$(string-append "-DLLVM_TARGET_ARCH="
> - (system->llvm-target))
> + (if (target-riscv64?)
> + "RISCV64"
> + (system->llvm-target)))
> #$(string-append "-DLLVM_TARGETS_TO_BUILD="
> (system->llvm-target)))
> '())
Hello, our `system->llvm-target` has riscv => "RISCV", does it wrong
(should be changed to RISCV64) or does it right only for 32bit RISCV?
And can system->llvm-target be fixed instead of fix each its usage?
Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [bug#62438] [PATCH] gnu: llvm: Fix riscv64 cross-compilation.
2023-03-25 12:13 [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile Z572 via Guix-patches via
2023-04-03 11:11 ` 宋文武 via Guix-patches via
@ 2023-04-08 5:32 ` Z572 via Guix-patches via
2023-06-09 21:12 ` [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile Ludovic Courtès
2023-09-07 10:42 ` [bug#62438] [PATCH v2] gnu: llvm: Fix riscv64 cross-compilation iyzsong--- via Guix-patches via
2 siblings, 1 reply; 9+ messages in thread
From: Z572 via Guix-patches via @ 2023-04-08 5:32 UTC (permalink / raw)
To: 62438
* gnu/packages/llvm.scm (system->llvm-target-arch): New procedure.
(llvm-15,llvm-14,llvm-12): Use It.
---
gnu/packages/llvm.scm | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index e5bf9f5cae..46cbd4d15a 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -101,6 +101,30 @@ (define* (system->llvm-target #:optional
("i686" => "X86")
("i586" => "X86"))))
+(define* (system->llvm-target-arch #:optional
+ (system (or (and=> (%current-target-system)
+ gnu-triplet->nix-system)
+ (%current-system))))
+ "Return the LLVM target arch name that corresponds to SYSTEM, a system type such
+as \"x86_64-linux\"."
+ ;; See the 'cmake/config-ix.cmake' file of LLVM for a list of supported targets arch.
+ ;; start with # Determine the native architecture.
+ (letrec-syntax ((matches (syntax-rules (=>)
+ ((_ (system-prefix => target) rest ...)
+ (if (string-prefix? system-prefix system)
+ target
+ (matches rest ...)))
+ ((_)
+ (error "LLVM target arch for system is unknown" system)))))
+ (matches ("aarch64" => "AArch64")
+ ("armhf" => "ARM")
+ ("mips64el" => "Mips")
+ ("powerpc" => "PowerPC")
+ ("riscv64" => "RISCV64")
+ ("x86_64" => "X86_64")
+ ("i686" => "X86")
+ ("i586" => "X86"))))
+
(define (llvm-uri component version)
;; LLVM release candidate file names are formatted 'tool-A.B.C-rcN/tool-A.B.CrcN.src.tar.xz'
;; so we specify the version as A.B.C-rcN and delete the hyphen when referencing the file name.
@@ -598,7 +622,7 @@ (define-public llvm-15
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (system->llvm-target-arch))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
'())
@@ -658,7 +682,7 @@ (define-public llvm-14
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (system->llvm-target-arch))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
'())
@@ -910,7 +934,7 @@ (define-public llvm-12
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (system->llvm-target-arch))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
#~())
base-commit: 6311493d7a6271bfbc51f4693857f9a12fe9965d
--
2.39.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile.
2023-04-08 5:32 ` [bug#62438] [PATCH] gnu: llvm: Fix riscv64 cross-compilation Z572 via Guix-patches via
@ 2023-06-09 21:12 ` Ludovic Courtès
[not found] ` <87jzwarpt9.fsf@qq.com>
0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2023-06-09 21:12 UTC (permalink / raw)
To: Z572; +Cc: 62438, 宋文武
Hi,
Z572 <873216071@qq.com> skribis:
> +(define* (system->llvm-target-arch #:optional
> + (system (or (and=> (%current-target-system)
> + gnu-triplet->nix-system)
> + (%current-system))))
> + "Return the LLVM target arch name that corresponds to SYSTEM, a system type such
> +as \"x86_64-linux\"."
> + ;; See the 'cmake/config-ix.cmake' file of LLVM for a list of supported targets arch.
> + ;; start with # Determine the native architecture.
> + (letrec-syntax ((matches (syntax-rules (=>)
> + ((_ (system-prefix => target) rest ...)
> + (if (string-prefix? system-prefix system)
> + target
> + (matches rest ...)))
> + ((_)
> + (error "LLVM target arch for system is unknown" system)))))
> + (matches ("aarch64" => "AArch64")
> + ("armhf" => "ARM")
> + ("mips64el" => "Mips")
> + ("powerpc" => "PowerPC")
> + ("riscv64" => "RISCV64")
> + ("x86_64" => "X86_64")
> + ("i686" => "X86")
> + ("i586" => "X86"))))
The only different compared to ‘system->llvm-target’ is “riscv64”
instead of “riscv”. Why not add that line to ‘system->llvm-target’
instead of duplicating it?
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [bug#62438] [PATCH v2] gnu: llvm: Fix riscv64 cross-compilation.
2023-03-25 12:13 [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile Z572 via Guix-patches via
2023-04-03 11:11 ` 宋文武 via Guix-patches via
2023-04-08 5:32 ` [bug#62438] [PATCH] gnu: llvm: Fix riscv64 cross-compilation Z572 via Guix-patches via
@ 2023-09-07 10:42 ` iyzsong--- via Guix-patches via
2023-10-19 19:55 ` Ludovic Courtès
2 siblings, 1 reply; 9+ messages in thread
From: iyzsong--- via Guix-patches via @ 2023-09-07 10:42 UTC (permalink / raw)
To: 62438; +Cc: Z572, 宋文武
From: Z572 <873216071@qq.com>
* gnu/packages/llvm.scm (system->llvm-target-arch): New procedure.
(llvm-15,llvm-14,llvm-12): Use It.
(system->llvm-target): Rewrite in terms of 'system->llvm-target-arch'.
Co-authored-by: 宋文武 <iyzsong@member.fsf.org>
---
gnu/packages/llvm.scm | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index daff67f7f2..cd551f4e02 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -85,19 +85,32 @@ (define* (system->llvm-target #:optional
"Return the LLVM target name that corresponds to SYSTEM, a system type such
as \"x86_64-linux\"."
;; See the 'lib/Target' directory of LLVM for a list of supported targets.
+ (match (system->llvm-target-arch system)
+ ("RISCV64" "RISCV")
+ ("X86_64" "X86")
+ (x x)))
+
+(define* (system->llvm-target-arch #:optional
+ (system (or (and=> (%current-target-system)
+ gnu-triplet->nix-system)
+ (%current-system))))
+ "Return the LLVM target arch name that corresponds to SYSTEM, a system type such
+as \"x86_64-linux\"."
+ ;; See the 'cmake/config-ix.cmake' file of LLVM for a list of supported targets arch.
+ ;; start with # Determine the native architecture.
(letrec-syntax ((matches (syntax-rules (=>)
((_ (system-prefix => target) rest ...)
(if (string-prefix? system-prefix system)
target
(matches rest ...)))
((_)
- (error "LLVM target for system is unknown" system)))))
+ (error "LLVM target arch for system is unknown" system)))))
(matches ("aarch64" => "AArch64")
("armhf" => "ARM")
("mips64el" => "Mips")
("powerpc" => "PowerPC")
- ("riscv" => "RISCV")
- ("x86_64" => "X86")
+ ("riscv64" => "RISCV64")
+ ("x86_64" => "X86_64")
("i686" => "X86")
("i586" => "X86"))))
@@ -598,7 +611,7 @@ (define-public llvm-15
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (system->llvm-target-arch))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
'())
@@ -658,7 +671,7 @@ (define-public llvm-14
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (system->llvm-target-arch))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
'())
@@ -901,7 +914,7 @@ (define-public llvm-12
#$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE="
(%current-target-system))
#$(string-append "-DLLVM_TARGET_ARCH="
- (system->llvm-target))
+ (system->llvm-target-arch))
#$(string-append "-DLLVM_TARGETS_TO_BUILD="
(system->llvm-target)))
#~())
base-commit: 5ef28595e9dff8b88ec3fcb4d887fbc380c9a8b8
--
2.41.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [bug#62438] [PATCH v2] gnu: llvm: Fix riscv64 cross-compilation.
2023-09-07 10:42 ` [bug#62438] [PATCH v2] gnu: llvm: Fix riscv64 cross-compilation iyzsong--- via Guix-patches via
@ 2023-10-19 19:55 ` Ludovic Courtès
2023-10-20 9:58 ` bug#62438: " 宋文武 via Guix-patches via
0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2023-10-19 19:55 UTC (permalink / raw)
To: iyzsong; +Cc: 62438, Z572, 宋文武
Hi,
iyzsong@envs.net skribis:
> From: Z572 <873216071@qq.com>
>
> * gnu/packages/llvm.scm (system->llvm-target-arch): New procedure.
> (llvm-15,llvm-14,llvm-12): Use It.
> (system->llvm-target): Rewrite in terms of 'system->llvm-target-arch'.
>
> Co-authored-by: 宋文武 <iyzsong@member.fsf.org>
I guess you can go ahead and apply it (sorry for dropping the ball
earlier!).
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#62438: [PATCH v2] gnu: llvm: Fix riscv64 cross-compilation.
2023-10-19 19:55 ` Ludovic Courtès
@ 2023-10-20 9:58 ` 宋文武 via Guix-patches via
0 siblings, 0 replies; 9+ messages in thread
From: 宋文武 via Guix-patches via @ 2023-10-20 9:58 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 62438-done, Z572
Ludovic Courtès <ludo@gnu.org> writes:
> Hi,
>
> iyzsong@envs.net skribis:
>
>> From: Z572 <873216071@qq.com>
>>
>> * gnu/packages/llvm.scm (system->llvm-target-arch): New procedure.
>> (llvm-15,llvm-14,llvm-12): Use It.
>> (system->llvm-target): Rewrite in terms of 'system->llvm-target-arch'.
>>
>> Co-authored-by: 宋文武 <iyzsong@member.fsf.org>
>
> I guess you can go ahead and apply it (sorry for dropping the ball
> earlier!).
>
Pushed, thank you!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-10-20 9:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-25 12:13 [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile Z572 via Guix-patches via
2023-04-03 11:11 ` 宋文武 via Guix-patches via
[not found] ` <87v8idq9wf.fsf_-_@qq.com>
2023-04-03 15:10 ` Z572 via Guix-patches via
2023-04-08 5:32 ` [bug#62438] [PATCH] gnu: llvm: Fix riscv64 cross-compilation Z572 via Guix-patches via
2023-06-09 21:12 ` [bug#62438] [PATCH] gnu: llvm: fix riscv64 cross-compile Ludovic Courtès
[not found] ` <87jzwarpt9.fsf@qq.com>
2023-06-11 14:57 ` Z572 via Guix-patches via
2023-09-07 10:42 ` [bug#62438] [PATCH v2] gnu: llvm: Fix riscv64 cross-compilation iyzsong--- via Guix-patches via
2023-10-19 19:55 ` Ludovic Courtès
2023-10-20 9:58 ` bug#62438: " 宋文武 via Guix-patches via
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).