* [bug#66701] [PATCH 01/14] gnu: clang-runtime-from-llvm: Adjust inputs for version 15 or later.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
@ 2023-10-23 12:36 ` Hilton Chain via Guix-patches via
2023-10-23 12:36 ` [bug#66701] [PATCH 02/14] gnu: clang-runtime-from-llvm: Add phase for LLVM monorepo Hilton Chain via Guix-patches via
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:36 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (clang-runtime-from-llvm)[native-inputs]: Add gcc-12
when version >= 15.
[inputs]: Add libffi when version >= 15.
(clang-runtime-15)[native-inputs,inputs]: Remove fields.
Change-Id: I4b385b937edbb7a2840b998b6dd3e31a17cb556f
---
gnu/packages/llvm.scm | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index cd551f4e02..38c4047f48 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 Hilton Chain <hako@ultrarare.space>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -139,9 +140,19 @@ (define* (clang-runtime-from-llvm llvm
(patches (map search-patch patches)))
(llvm-monorepo (package-version llvm))))
(build-system cmake-build-system)
- (native-inputs (package-native-inputs llvm))
+ (native-inputs
+ (if (version>=? version "15")
+ ;; TODO: Remove this when GCC 12 is the default.
+ ;; libfuzzer fails to build with GCC 11
+ (modify-inputs (package-native-inputs llvm)
+ (prepend gcc-12))
+ (package-native-inputs llvm)))
(inputs
- (list llvm))
+ (append
+ (list llvm)
+ (if (version>=? version "15")
+ (list libffi)
+ '())))
(arguments
`(;; Don't use '-g' during the build to save space.
#:build-type "Release"
@@ -712,13 +723,7 @@ (define-public clang-runtime-15
#~(modify-phases #$phases
(add-after 'unpack 'change-directory
(lambda _
- (chdir "compiler-rt")))))))
- (native-inputs
- (modify-inputs (package-native-inputs template)
- (prepend gcc-12))) ;libfuzzer fails to build with GCC 11
- (inputs
- (modify-inputs (package-inputs template)
- (append libffi))))))
+ (chdir "compiler-rt"))))))))))
(define-public clang-runtime-14
(let ((template (clang-runtime-from-llvm llvm-14)))
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 02/14] gnu: clang-runtime-from-llvm: Add phase for LLVM monorepo.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
2023-10-23 12:36 ` [bug#66701] [PATCH 01/14] gnu: clang-runtime-from-llvm: Adjust inputs for version 15 or later Hilton Chain via Guix-patches via
@ 2023-10-23 12:36 ` Hilton Chain via Guix-patches via
2023-10-23 12:36 ` [bug#66701] [PATCH 03/14] gnu: Add llvm-16 Hilton Chain via Guix-patches via
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:36 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (clang-runtime-from-llvm)[arguments]<#:phases>: Change
directory to "compiler-rt" for LLVM monorepo.
(clang-runtime-15,clang-runtime-14): Adjust accordingly.
Change-Id: I6a77c9d106439e4794b8531e2160e2c9ce63d86e
---
gnu/packages/llvm.scm | 27 +++++++--------------------
1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 38c4047f48..97902fcf5c 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -161,6 +161,11 @@ (define* (clang-runtime-from-llvm llvm
(ice-9 match)
,@%cmake-build-system-modules)
#:phases (modify-phases (@ (guix build cmake-build-system) %standard-phases)
+ ,@(if hash
+ '()
+ '((add-after 'unpack 'change-directory
+ (lambda _
+ (chdir "compiler-rt")))))
(add-after 'set-paths 'hide-glibc
;; Work around https://issues.guix.info/issue/36882. We need to
;; remove glibc from CPLUS_INCLUDE_PATH so that the one hardcoded
@@ -714,28 +719,10 @@ (define-public llvm-14
("perl" ,perl)))))
(define-public clang-runtime-15
- (let ((template (clang-runtime-from-llvm llvm-15)))
- (package
- (inherit template)
- (arguments
- (substitute-keyword-arguments (package-arguments template)
- ((#:phases phases '(@ (guix build cmake-build-system) %standard-phases))
- #~(modify-phases #$phases
- (add-after 'unpack 'change-directory
- (lambda _
- (chdir "compiler-rt"))))))))))
+ (clang-runtime-from-llvm llvm-15))
(define-public clang-runtime-14
- (let ((template (clang-runtime-from-llvm llvm-14)))
- (package
- (inherit template)
- (arguments
- (substitute-keyword-arguments (package-arguments template)
- ((#:phases phases '(@ (guix build cmake-build-system) %standard-phases))
- #~(modify-phases #$phases
- (add-after 'unpack 'change-directory
- (lambda _
- (chdir "compiler-rt"))))))))))
+ (clang-runtime-from-llvm llvm-14))
(define-public clang-15
(clang-from-llvm
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 03/14] gnu: Add llvm-16.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
2023-10-23 12:36 ` [bug#66701] [PATCH 01/14] gnu: clang-runtime-from-llvm: Adjust inputs for version 15 or later Hilton Chain via Guix-patches via
2023-10-23 12:36 ` [bug#66701] [PATCH 02/14] gnu: clang-runtime-from-llvm: Add phase for LLVM monorepo Hilton Chain via Guix-patches via
@ 2023-10-23 12:36 ` Hilton Chain via Guix-patches via
2023-10-23 12:36 ` [bug#66701] [PATCH 04/14] gnu: Add clang-runtime-16 Hilton Chain via Guix-patches via
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:36 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (llvm-16): New variable.
* gnu/packages/patches/clang-16.0-libc-search-path.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
Change-Id: I27738152ca95aeeef8d8b7150fdf14825b6b0b4d
---
gnu/local.mk | 1 +
gnu/packages/llvm.scm | 12 ++-
.../patches/clang-16.0-libc-search-path.patch | 95 +++++++++++++++++++
3 files changed, 106 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/clang-16.0-libc-search-path.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 43145caf80..d606cffd1f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1016,6 +1016,7 @@ dist_patch_DATA = \
%D%/packages/patches/clang-13.0-libc-search-path.patch \
%D%/packages/patches/clang-14.0-libc-search-path.patch \
%D%/packages/patches/clang-15.0-libc-search-path.patch \
+ %D%/packages/patches/clang-16.0-libc-search-path.patch \
%D%/packages/patches/clang-runtime-asan-build-fixes.patch \
%D%/packages/patches/clang-runtime-esan-build-fixes.patch \
%D%/packages/patches/clang-runtime-9-libsanitizer-mode-field.patch \
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 97902fcf5c..6014787efc 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -590,11 +590,13 @@ (define-public (make-clang-toolchain clang libomp)
(define %llvm-monorepo-hashes
'(("14.0.6" . "14f8nlvnmdkp9a9a79wv67jbmafvabczhah8rwnqrgd5g3hfxxxx")
- ("15.0.7" . "12sggw15sxq1krh1mfk3c1f07h895jlxbcifpwk3pznh4m1rjfy2")))
+ ("15.0.7" . "12sggw15sxq1krh1mfk3c1f07h895jlxbcifpwk3pznh4m1rjfy2")
+ ("16.0.6" . "0jxmapg7shwkl88m4mqgfjv4ziqdmnppxhjz6vz51ycp2x4nmjky")))
(define %llvm-patches
'(("14.0.6" . ("clang-14.0-libc-search-path.patch"))
- ("15.0.7" . ("clang-15.0-libc-search-path.patch"))))
+ ("15.0.7" . ("clang-15.0-libc-search-path.patch"))
+ ("16.0.6" . ("clang-16.0-libc-search-path.patch"))))
(define (llvm-monorepo version)
(origin
@@ -1450,6 +1452,12 @@ (define-public clang-3.5
#:legacy-build-shared-libs? #t
#:patches '("clang-3.5-libc-search-path.patch")))
+(define-public llvm-16
+ (package
+ (inherit llvm-15)
+ (version "16.0.6")
+ (source (llvm-monorepo version))))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
diff --git a/gnu/packages/patches/clang-16.0-libc-search-path.patch b/gnu/packages/patches/clang-16.0-libc-search-path.patch
new file mode 100644
index 0000000000..282f58f03b
--- /dev/null
+++ b/gnu/packages/patches/clang-16.0-libc-search-path.patch
@@ -0,0 +1,95 @@
+Clang attempts to guess file names based on the OS and distro (yes!),
+but unfortunately, that doesn't work for us.
+
+This patch makes it easy to insert libc's $libdir so that Clang passes the
+correct absolute file name of crt1.o etc. to 'ld'. It also disables all
+the distro-specific stuff and removes the hard-coded FHS directory names
+to make sure Clang also works on foreign distros.
+
+diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
+index 87a0c5a58511..86ea82eda4b5 100644
+--- a/clang/lib/Driver/Distro.cpp
++++ b/clang/lib/Driver/Distro.cpp
+@@ -98,6 +98,10 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
+ }
+
+ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
++ // The compiler should always behave the same, even when used via Guix on a
++ // foreign distro.
++ return Distro::UnknownDistro;
++
+ Distro::DistroType Version = Distro::UnknownDistro;
+
+ // Newer freedesktop.org's compilant systemd-based systems
+diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
+index aa125bb308e8..8b86e144054c 100644
+--- a/clang/lib/Driver/ToolChains/Cuda.cpp
++++ b/clang/lib/Driver/ToolChains/Cuda.cpp
+@@ -124,6 +124,9 @@ CudaInstallationDetector::CudaInstallationDetector(
+ const Driver &D, const llvm::Triple &HostTriple,
+ const llvm::opt::ArgList &Args)
+ : D(D) {
++ // Don't look for CUDA in /usr.
++ return;
++
+ struct Candidate {
+ std::string Path;
+ bool StrictChecking;
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index c6fb290ffdb4..4736f4bb3392 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -189,6 +189,10 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ Generic_GCC::PushPPaths(PPaths);
+
++ // Comment out the distro-specific tweaks so that they don't bite when
++ // using Guix on a foreign distro.
++#if 0
++
+ Distro Distro(D.getVFS(), Triple);
+
+ if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
+@@ -249,6 +253,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ #ifdef ENABLE_LINKER_BUILD_ID
+ ExtraOpts.push_back("--build-id");
++#endif
+ #endif
+
+ // The selection of paths to try here is designed to match the patterns which
+@@ -270,6 +275,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ }
+ Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
+
++#if 0
+ addPathIfExists(D, concat(SysRoot, "/lib", MultiarchTriple), Paths);
+ addPathIfExists(D, concat(SysRoot, "/lib/..", OSLibDir), Paths);
+
+@@ -298,9 +304,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ addPathIfExists(D, concat(SysRoot, "/", OSLibDir, ABIName), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir, ABIName), Paths);
+ }
++#endif
+
+ Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
+
++#if 0
+ // The deprecated -DLLVM_ENABLE_PROJECTS=libcxx configuration installs
+ // libc++.so in D.Dir+"/../lib/". Detect this path.
+ // TODO Remove once LLVM_ENABLE_PROJECTS=libcxx is unsupported.
+@@ -310,6 +318,14 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ addPathIfExists(D, concat(SysRoot, "/lib"), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths);
++#endif
++
++ // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
++ // and friends can be found.
++ addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
++
++ // Add GCC's lib/ directory so libstdc++.so can be found.
++ addPathIfExists(D, GCCInstallation.getParentLibPath(), Paths);
+ }
+
+ ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 04/14] gnu: Add clang-runtime-16.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (2 preceding siblings ...)
2023-10-23 12:36 ` [bug#66701] [PATCH 03/14] gnu: Add llvm-16 Hilton Chain via Guix-patches via
@ 2023-10-23 12:36 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 05/14] gnu: Add clang-16 Hilton Chain via Guix-patches via
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:36 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (clang-runtime-16): New variable.
Change-Id: I8812e9e72b711505f7575cc3d62a9a009d25f641
---
gnu/packages/llvm.scm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 6014787efc..0b1403deb6 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1458,6 +1458,9 @@ (define-public llvm-16
(version "16.0.6")
(source (llvm-monorepo version))))
+(define-public clang-runtime-16
+ (clang-runtime-from-llvm llvm-16))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 05/14] gnu: Add clang-16.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (3 preceding siblings ...)
2023-10-23 12:36 ` [bug#66701] [PATCH 04/14] gnu: Add clang-runtime-16 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 06/14] gnu: Add libomp-16 Hilton Chain via Guix-patches via
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (clang-16): New variable.
Change-Id: I0e62bced33d2ff5a3064917d4e95004d43dc56fb
---
gnu/packages/llvm.scm | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 0b1403deb6..f4b69a7141 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1461,6 +1461,18 @@ (define-public llvm-16
(define-public clang-runtime-16
(clang-runtime-from-llvm llvm-16))
+(define-public clang-16
+ (clang-from-llvm
+ llvm-16 clang-runtime-16
+ #:tools-extra
+ (origin
+ (method url-fetch)
+ (uri (llvm-uri "clang-tools-extra"
+ (package-version llvm-16)))
+ (sha256
+ (base32
+ "0cbgffciql06a1i0ybyyqbnkkr4g7x8cxaar5a5v3415vd27hk0p")))))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 06/14] gnu: Add libomp-16.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (4 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 05/14] gnu: Add clang-16 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 07/14] gnu: Add clang-toolchain-16 Hilton Chain via Guix-patches via
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (libomp-16): New variable.
Change-Id: I2a396f7c7a4c0e35a15ed315c291b4298c0ee967
---
gnu/packages/llvm.scm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index f4b69a7141..5ba29e3236 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1473,6 +1473,16 @@ (define-public clang-16
(base32
"0cbgffciql06a1i0ybyyqbnkkr4g7x8cxaar5a5v3415vd27hk0p")))))
+(define-public libomp-16
+ (package
+ (inherit libomp-15)
+ (version (package-version llvm-16))
+ (source (llvm-monorepo version))
+ (native-inputs
+ (modify-inputs (package-native-inputs libomp-15)
+ (replace "clang" clang-16)
+ (replace "llvm" llvm-16)))))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 07/14] gnu: Add clang-toolchain-16.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (5 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 06/14] gnu: Add libomp-16 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 08/14] gnu: Add lld-16 Hilton Chain via Guix-patches via
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (clang-toolchain-16): New variable.
Change-Id: I4bc7820b249ab93ff8b7143901c8e4220b7b8b5b
---
gnu/packages/llvm.scm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 5ba29e3236..879e843e4a 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1483,6 +1483,9 @@ (define-public libomp-16
(replace "clang" clang-16)
(replace "llvm" llvm-16)))))
+(define-public clang-toolchain-16
+ (make-clang-toolchain clang-16 libomp-16))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 08/14] gnu: Add lld-16.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (6 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 07/14] gnu: Add clang-toolchain-16 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 09/14] gnu: Add llvm-17 Hilton Chain via Guix-patches via
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (lld-16): New variable.
Change-Id: If34c0785531bc3603a56f18c18a8e4318cabc493
---
gnu/packages/llvm.scm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 879e843e4a..ee2131b0dd 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1630,6 +1630,13 @@ (define-public lld-11
(inputs (modify-inputs (package-inputs lld)
(replace "llvm" llvm-11)))))
+(define-public lld-16
+ (package
+ (inherit lld-15)
+ (version (package-version llvm-16))
+ (source (llvm-monorepo version))
+ (inputs (list llvm-16))))
+
(define-public lld lld-14)
(define* (make-lld-wrapper lld #:key lld-as-ld?)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 09/14] gnu: Add llvm-17.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (7 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 08/14] gnu: Add lld-16 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 10/14] gnu: Add clang-runtime-17 Hilton Chain via Guix-patches via
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (llvm-17): New variable.
* gnu/packages/patches/clang-17.0-libc-search-path.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
Change-Id: I8cdda0737b1137cf86887fb5b854e71977a88b6b
---
gnu/local.mk | 1 +
gnu/packages/llvm.scm | 12 ++-
.../patches/clang-17.0-libc-search-path.patch | 90 +++++++++++++++++++
3 files changed, 101 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/clang-17.0-libc-search-path.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index d606cffd1f..6057456c2b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1017,6 +1017,7 @@ dist_patch_DATA = \
%D%/packages/patches/clang-14.0-libc-search-path.patch \
%D%/packages/patches/clang-15.0-libc-search-path.patch \
%D%/packages/patches/clang-16.0-libc-search-path.patch \
+ %D%/packages/patches/clang-17.0-libc-search-path.patch \
%D%/packages/patches/clang-runtime-asan-build-fixes.patch \
%D%/packages/patches/clang-runtime-esan-build-fixes.patch \
%D%/packages/patches/clang-runtime-9-libsanitizer-mode-field.patch \
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index ee2131b0dd..eb806b9cf0 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -591,12 +591,14 @@ (define-public (make-clang-toolchain clang libomp)
(define %llvm-monorepo-hashes
'(("14.0.6" . "14f8nlvnmdkp9a9a79wv67jbmafvabczhah8rwnqrgd5g3hfxxxx")
("15.0.7" . "12sggw15sxq1krh1mfk3c1f07h895jlxbcifpwk3pznh4m1rjfy2")
- ("16.0.6" . "0jxmapg7shwkl88m4mqgfjv4ziqdmnppxhjz6vz51ycp2x4nmjky")))
+ ("16.0.6" . "0jxmapg7shwkl88m4mqgfjv4ziqdmnppxhjz6vz51ycp2x4nmjky")
+ ("17.0.3" . "1fhrnsv87if7kbqmrsxy2r7ykx3gnr9lmbmvkhvycc91ii4ihybx")))
(define %llvm-patches
'(("14.0.6" . ("clang-14.0-libc-search-path.patch"))
("15.0.7" . ("clang-15.0-libc-search-path.patch"))
- ("16.0.6" . ("clang-16.0-libc-search-path.patch"))))
+ ("16.0.6" . ("clang-16.0-libc-search-path.patch"))
+ ("17.0.3" . ("clang-17.0-libc-search-path.patch"))))
(define (llvm-monorepo version)
(origin
@@ -1486,6 +1488,12 @@ (define-public libomp-16
(define-public clang-toolchain-16
(make-clang-toolchain clang-16 libomp-16))
+(define-public llvm-17
+ (package
+ (inherit llvm-15)
+ (version "17.0.3")
+ (source (llvm-monorepo version))))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
diff --git a/gnu/packages/patches/clang-17.0-libc-search-path.patch b/gnu/packages/patches/clang-17.0-libc-search-path.patch
new file mode 100644
index 0000000000..dd4d8cb998
--- /dev/null
+++ b/gnu/packages/patches/clang-17.0-libc-search-path.patch
@@ -0,0 +1,90 @@
+Clang attempts to guess file names based on the OS and distro (yes!),
+but unfortunately, that doesn't work for us.
+
+This patch makes it easy to insert libc's $libdir so that Clang passes the
+correct absolute file name of crt1.o etc. to 'ld'. It also disables all
+the distro-specific stuff and removes the hard-coded FHS directory names
+to make sure Clang also works on foreign distros.
+
+diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
+index 6e0087565941..c0a3ba7d7702 100644
+--- a/clang/lib/Driver/Distro.cpp
++++ b/clang/lib/Driver/Distro.cpp
+@@ -99,6 +99,10 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
+ }
+
+ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
++ // The compiler should always behave the same, even when used via Guix on a
++ // foreign distro.
++ return Distro::UnknownDistro;
++
+ Distro::DistroType Version = Distro::UnknownDistro;
+
+ // Newer freedesktop.org's compilant systemd-based systems
+diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
+index 3a577650eb08..ca3373edc127 100644
+--- a/clang/lib/Driver/ToolChains/Cuda.cpp
++++ b/clang/lib/Driver/ToolChains/Cuda.cpp
+@@ -128,6 +128,9 @@ CudaInstallationDetector::CudaInstallationDetector(
+ const Driver &D, const llvm::Triple &HostTriple,
+ const llvm::opt::ArgList &Args)
+ : D(D) {
++ // Don't look for CUDA in /usr.
++ return;
++
+ struct Candidate {
+ std::string Path;
+ bool StrictChecking;
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index 1ba222bf83b1..28766c5ab792 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -220,6 +220,10 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ Generic_GCC::PushPPaths(PPaths);
+
++ // Comment out the distro-specific tweaks so that they don't bite when
++ // using Guix on a foreign distro.
++#if 0
++
+ Distro Distro(D.getVFS(), Triple);
+
+ if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
+@@ -280,6 +284,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ #ifdef ENABLE_LINKER_BUILD_ID
+ ExtraOpts.push_back("--build-id");
++#endif
+ #endif
+
+ // The selection of paths to try here is designed to match the patterns which
+@@ -301,6 +306,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ }
+ Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
+
++#if 0
+ addPathIfExists(D, concat(SysRoot, "/lib", MultiarchTriple), Paths);
+ addPathIfExists(D, concat(SysRoot, "/lib/..", OSLibDir), Paths);
+
+@@ -329,11 +335,21 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ addPathIfExists(D, concat(SysRoot, "/", OSLibDir, ABIName), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir, ABIName), Paths);
+ }
++#endif
+
+ Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
+
++#if 0
+ addPathIfExists(D, concat(SysRoot, "/lib"), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths);
++#endif
++
++ // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
++ // and friends can be found.
++ addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
++
++ // Add GCC's lib/ directory so libstdc++.so can be found.
++ addPathIfExists(D, GCCInstallation.getParentLibPath(), Paths);
+ }
+
+ ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 10/14] gnu: Add clang-runtime-17.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (8 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 09/14] gnu: Add llvm-17 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 11/14] gnu: Add clang-17 Hilton Chain via Guix-patches via
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (clang-runtime-17): New variable.
Change-Id: I675475e9f4914843283966f5c622cdb214d11e34
---
gnu/packages/llvm.scm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index eb806b9cf0..06ecbf7e1b 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1494,6 +1494,9 @@ (define-public llvm-17
(version "17.0.3")
(source (llvm-monorepo version))))
+(define-public clang-runtime-17
+ (clang-runtime-from-llvm llvm-17))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 11/14] gnu: Add clang-17.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (9 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 10/14] gnu: Add clang-runtime-17 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 12/14] gnu: Add libomp-17 Hilton Chain via Guix-patches via
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (clang-from-llvm)[arguments]: Include test runner in
CMakeLists.txt when version >= 17.
(clang-17): New variable.
Change-Id: Ia3cd8013d497b72522e95f6face5975bf79f93b3
---
gnu/packages/llvm.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 06ecbf7e1b..8dc87ad01b 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -358,6 +358,15 @@ (define* (clang-from-llvm llvm clang-runtime
(("@GLIBC_LIBDIR@")
(string-append libc "/lib"))))))
#t)))
+ ,@(if (version>=? version "17")
+ '((add-after 'unpack 'include-test-runner
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ ((".*llvm_gtest" line)
+ (string-append
+ "add_subdirectory(${LLVM_THIRD_PARTY_DIR}/uni\
+ttest third-party/unittest)\n" line))))))
+ '())
;; Awkwardly, multiple phases added after the same phase,
;; e.g. unpack, get applied in the reverse order. In other
;; words, adding 'change-directory last means it occurs
@@ -1497,6 +1506,18 @@ (define-public llvm-17
(define-public clang-runtime-17
(clang-runtime-from-llvm llvm-17))
+(define-public clang-17
+ (clang-from-llvm
+ llvm-17 clang-runtime-17
+ #:tools-extra
+ (origin
+ (method url-fetch)
+ (uri (llvm-uri "clang-tools-extra"
+ (package-version llvm-17)))
+ (sha256
+ (base32
+ "0an16xdc8rgrdf0dcq3sdg82ajyb00h4bff9n0gm7gqf48ds0da8")))))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 12/14] gnu: Add libomp-17.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (10 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 11/14] gnu: Add clang-17 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 13/14] gnu: Add clang-toolchain-17 Hilton Chain via Guix-patches via
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (libomp-17): New variable.
Change-Id: I6ad09d8feff0053dfc811a741e00445dfecb311f
---
gnu/packages/llvm.scm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 8dc87ad01b..1f37f42a17 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1518,6 +1518,16 @@ (define-public clang-17
(base32
"0an16xdc8rgrdf0dcq3sdg82ajyb00h4bff9n0gm7gqf48ds0da8")))))
+(define-public libomp-17
+ (package
+ (inherit libomp-15)
+ (version (package-version llvm-17))
+ (source (llvm-monorepo version))
+ (native-inputs
+ (modify-inputs (package-native-inputs libomp-15)
+ (replace "clang" clang-17)
+ (replace "llvm" llvm-17)))))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 13/14] gnu: Add clang-toolchain-17.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (11 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 12/14] gnu: Add libomp-17 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-10-23 12:43 ` [bug#66701] [PATCH 14/14] gnu: Add lld-17 Hilton Chain via Guix-patches via
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (clang-toolchain-17): New variable.
Change-Id: Iefec981c84249db0d1c740c156835dfea9030f47
---
gnu/packages/llvm.scm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 1f37f42a17..795488abee 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1528,6 +1528,9 @@ (define-public libomp-17
(replace "clang" clang-17)
(replace "llvm" llvm-17)))))
+(define-public clang-toolchain-17
+ (make-clang-toolchain clang-17 libomp-17))
+
;; Default LLVM and Clang version.
(define-public libomp libomp-13)
(define-public llvm llvm-13)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] [PATCH 14/14] gnu: Add lld-17.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (12 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 13/14] gnu: Add clang-toolchain-17 Hilton Chain via Guix-patches via
@ 2023-10-23 12:43 ` Hilton Chain via Guix-patches via
2023-11-06 14:47 ` [bug#66701] Add LLVM 16 and 17 Michael Ford
2023-11-12 14:14 ` bug#66701: [PATCH 00/14] " Efraim Flashner
15 siblings, 0 replies; 17+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-10-23 12:43 UTC (permalink / raw)
To: 66701; +Cc: Hilton Chain, Hilton Chain
* gnu/packages/llvm.scm (lld-17): New variable.
Change-Id: Idbb84efc1c749179dfdb874390bfc1caf4e753d3
---
gnu/packages/llvm.scm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 795488abee..c3269ce013 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1682,6 +1682,13 @@ (define-public lld-16
(source (llvm-monorepo version))
(inputs (list llvm-16))))
+(define-public lld-17
+ (package
+ (inherit lld-15)
+ (version (package-version llvm-17))
+ (source (llvm-monorepo version))
+ (inputs (list llvm-17))))
+
(define-public lld lld-14)
(define* (make-lld-wrapper lld #:key lld-as-ld?)
--
2.41.0
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [bug#66701] Add LLVM 16 and 17.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (13 preceding siblings ...)
2023-10-23 12:43 ` [bug#66701] [PATCH 14/14] gnu: Add lld-17 Hilton Chain via Guix-patches via
@ 2023-11-06 14:47 ` Michael Ford
2023-11-12 14:14 ` bug#66701: [PATCH 00/14] " Efraim Flashner
15 siblings, 0 replies; 17+ messages in thread
From: Michael Ford @ 2023-11-06 14:47 UTC (permalink / raw)
To: 66701
Hi Hilton,
Awesome work.
Looking forward to making use of this in the near future.
Thanks,
Michael
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#66701: [PATCH 00/14] Add LLVM 16 and 17.
2023-10-23 12:28 [bug#66701] [PATCH 00/14] Add LLVM 16 and 17 Hilton Chain via Guix-patches via
` (14 preceding siblings ...)
2023-11-06 14:47 ` [bug#66701] Add LLVM 16 and 17 Michael Ford
@ 2023-11-12 14:14 ` Efraim Flashner
15 siblings, 0 replies; 17+ messages in thread
From: Efraim Flashner @ 2023-11-12 14:14 UTC (permalink / raw)
To: Hilton Chain; +Cc: 66701-done
[-- Attachment #1: Type: text/plain, Size: 238 bytes --]
Thanks! Patches pushed.
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread