GNU bug report logs - #66701
[PATCH 00/14] Add LLVM 16 and 17.

Previous Next

Package: guix-patches;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Mon, 23 Oct 2023 12:31:01 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

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 66701 in the body.
You can then email your comments to 66701 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#66701; Package guix-patches. (Mon, 23 Oct 2023 12:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hilton Chain <hako <at> ultrarare.space>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 23 Oct 2023 12:31:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: guix-patches <at> gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 00/14] Add LLVM 16 and 17.
Date: Mon, 23 Oct 2023 20:28:04 +0800
Hello Guix!

This series adds {llvm,clang-runtime,clang,libomp,clang-toolchain,lld}-{16,17}

I'm also intended to group packages with the same name together and make lower
versions the base that higher versions inherit from.  But the number of
affected packages would require a new branch or go into core-updates, so I'll
send a new series for it.

Thanks

Hilton Chain (14):
  gnu: clang-runtime-from-llvm: Adjust inputs for version 15 or later.
  gnu: clang-runtime-from-llvm: Add phase for LLVM monorepo.
  gnu: Add llvm-16.
  gnu: Add clang-runtime-16.
  gnu: Add clang-16.
  gnu: Add libomp-16.
  gnu: Add clang-toolchain-16.
  gnu: Add lld-16.
  gnu: Add llvm-17.
  gnu: Add clang-runtime-17.
  gnu: Add clang-17.
  gnu: Add libomp-17.
  gnu: Add clang-toolchain-17.
  gnu: Add lld-17.

 gnu/local.mk                                  |   2 +
 gnu/packages/llvm.scm                         | 147 ++++++++++++++----
 .../patches/clang-16.0-libc-search-path.patch |  95 +++++++++++
 .../patches/clang-17.0-libc-search-path.patch |  90 +++++++++++
 4 files changed, 304 insertions(+), 30 deletions(-)
 create mode 100644 gnu/packages/patches/clang-16.0-libc-search-path.patch
 create mode 100644 gnu/packages/patches/clang-17.0-libc-search-path.patch


base-commit: b6619c5db410fb01e552c6168bd6bc7f41c6c993
--
2.41.0




Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:39:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 01/14] gnu: clang-runtime-from-llvm: Adjust inputs for version
 15 or later.
Date: Mon, 23 Oct 2023 20:36:09 +0800
* 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 <at> protonmail.com>
 ;;; Copyright © 2022 Clément Lassieur <clement <at> lassieur.org>
 ;;; Copyright © 2022 Zhu Zihao <all_but_last <at> 163.com>
+;;; Copyright © 2023 Hilton Chain <hako <at> 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:39:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 02/14] gnu: clang-runtime-from-llvm: Add phase for LLVM
 monorepo.
Date: Mon, 23 Oct 2023 20:36:10 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:39:03 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 03/14] gnu: Add llvm-16.
Date: Mon, 23 Oct 2023 20:36:11 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:39:03 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 04/14] gnu: Add clang-runtime-16.
Date: Mon, 23 Oct 2023 20:36:12 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:47:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 05/14] gnu: Add clang-16.
Date: Mon, 23 Oct 2023 20:43:49 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:47:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 06/14] gnu: Add libomp-16.
Date: Mon, 23 Oct 2023 20:43:50 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:47:03 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 07/14] gnu: Add clang-toolchain-16.
Date: Mon, 23 Oct 2023 20:43:51 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:47:03 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 08/14] gnu: Add lld-16.
Date: Mon, 23 Oct 2023 20:43:52 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:47:03 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 09/14] gnu: Add llvm-17.
Date: Mon, 23 Oct 2023 20:43:53 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:47:04 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 10/14] gnu: Add clang-runtime-17.
Date: Mon, 23 Oct 2023 20:43:54 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:47:04 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 11/14] gnu: Add clang-17.
Date: Mon, 23 Oct 2023 20:43:55 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:47:05 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 12/14] gnu: Add libomp-17.
Date: Mon, 23 Oct 2023 20:43:56 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:48:01 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 13/14] gnu: Add clang-toolchain-17.
Date: Mon, 23 Oct 2023 20:43:57 +0800
* 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





Information forwarded to hako <at> ultrarare.space, guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 23 Oct 2023 12:48:02 GMT) Full text and rfc822 format available.

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

From: Hilton Chain <hako <at> ultrarare.space>
To: 66701 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH 14/14] gnu: Add lld-17.
Date: Mon, 23 Oct 2023 20:43:58 +0800
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#66701; Package guix-patches. (Mon, 06 Nov 2023 14:49:02 GMT) Full text and rfc822 format available.

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

From: Michael Ford <fanquake <at> gmail.com>
To: 66701 <at> debbugs.gnu.org
Subject: Add LLVM 16 and 17.
Date: Mon, 6 Nov 2023 14:47:24 +0000
Hi Hilton,

Awesome work.
Looking forward to making use of this in the near future.

Thanks,

Michael




Reply sent to Efraim Flashner <efraim <at> flashner.co.il>:
You have taken responsibility. (Sun, 12 Nov 2023 14:16:02 GMT) Full text and rfc822 format available.

Notification sent to Hilton Chain <hako <at> ultrarare.space>:
bug acknowledged by developer. (Sun, 12 Nov 2023 14:16:02 GMT) Full text and rfc822 format available.

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

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: 66701-done <at> debbugs.gnu.org
Subject: Re: [bug#66701] [PATCH 00/14] Add LLVM 16 and 17.
Date: Sun, 12 Nov 2023 16:14:41 +0200
[Message part 1 (text/plain, inline)]
Thanks! Patches pushed.

-- 
Efraim Flashner   <efraim <at> 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
[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. (Mon, 11 Dec 2023 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 150 days ago.

Previous Next


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