GNU bug report logs - #49471
[PATCH] gnu: lld: Update to 12.0.0.

Previous Next

Package: guix-patches;

Reported by: terramorpha <at> cock.li

Date: Thu, 8 Jul 2021 21:40:02 UTC

Severity: normal

Tags: patch

Done: Sarah Morgensen <iskarian <at> mgsn.dev>

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 49471 in the body.
You can then email your comments to 49471 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#49471; Package guix-patches. (Thu, 08 Jul 2021 21:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to terramorpha <at> cock.li:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 08 Jul 2021 21:40:02 GMT) Full text and rfc822 format available.

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

From: terramorpha <at> cock.li
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: lld: Update to 12.0.0.
Date: Thu, 08 Jul 2021 17:39:48 -0400
Hi guix. While updating my personal package definition of zig to 0.8.0, 
I had to write one for lld <at> 12 too.
(IIUC, only llvm and clang were upgraded to 12, I couldn't find lld when 
`guix search`-ing)

Anyway, the release tarball assumes that it will be unpacked and built 
in the same directory as the libunwind source.
This is why at build time, I added a phase to patch the CMakeLists.txt 
and make it look for libunwind in a specific place.

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#49471; Package guix-patches. (Thu, 08 Jul 2021 21:46:02 GMT) Full text and rfc822 format available.

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

From: terramorpha <at> cock.li
To: 49471 <at> debbugs.gnu.org
Subject: the actual patch
Date: Thu, 08 Jul 2021 17:45:34 -0400
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 575c63c713..b3c1c943f7 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -882,21 +882,40 @@ of programming tools as well as libraries with 
equivalent functionality.")
 (define-public clang clang-9)
 (define-public clang-toolchain clang-toolchain-9)

-(define-public lld
+
+(define libunwind-12-source
+  (origin (method url-fetch)
+                     (uri (llvm-uri "libunwind" "12.0.0"))
+                     (sha256 (base32 
"1x8wpmsrsgnwj2v5ih52ylni7r6n8gzkcj6hx65zbxski2rablly"))))
+
+(define-public lld-12
   (package
     (name "lld")
-    (version "11.0.0")
+    (version "12.0.0")
     (source (origin
               (method url-fetch)
               (uri (llvm-uri "lld" version))
               (sha256
                (base32
-                
"077xyh7sij6mhp4dc4kdcmp9whrpz332fa12rwxnzp3wgd5bxrzg"))))
+                
"1zakyxk5bwnh7jarckcd4rbmzi58jgn2dbah5j5cwcyfyfbx9drc"))))
     (build-system cmake-build-system)
     (inputs
-     `(("llvm" ,llvm-11)))
+     `(("llvm" ,llvm-12)
+       ("libunwind-source" ,libunwind-12-source)))
     (arguments
-     `(#:build-type "Release"
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'extract-libunwind-and-patch-path
+           (lambda* (#:key inputs #:allow-other-keys)
+             (invoke "tar" "-xf" (assoc-ref inputs "libunwind-source"))
+             (substitute "MachO/CMakeLists.txt"
+                         ;; The build script assumes that the libunwind 
code
+                         ;; is the source's sibling directory. Patch it 
so
+                         ;; that it finds it directly where we put it
+                         (list (cons 
"include_directories\\(\\$\\{LLVM_MAIN_SRC_DIR\\}\\/\\.\\.\\/libunwind\\/include)"
+                                     (const (string-append 
"include_directories(" (getcwd) "/libunwind-12.0.0.src" "/include)")))))
+             #t)))
+       #:build-type "Release"
        ;; TODO: Tests require the lit tool, which isn't installed by 
the LLVM
        ;; package.
        #:tests? #f))
@@ -904,7 +923,7 @@ of programming tools as well as libraries with 
equivalent functionality.")
     (synopsis "Linker from the LLVM project")
     (description "LLD is a high-performance linker, built as a set of 
reusable
 components which highly leverage existing libraries in the larger LLVM 
Project.")
-    (license license:asl2.0))) ; With LLVM exception
+    (license license:asl2.0))) ; With LLVM exceptions

 (define-public lldb
   (package




Information forwarded to guix-patches <at> gnu.org:
bug#49471; Package guix-patches. (Fri, 09 Jul 2021 22:07:01 GMT) Full text and rfc822 format available.

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

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: 49471 <at> debbugs.gnu.org
Subject: [PATCH] gnu: lld: Update to 12.0.0.
Date: Sat, 10 Jul 2021 00:06:06 +0200
* gnu/packages/llvm.scm (llvm-subprojects-origin, %llvm-project-12.0.0-hash):
New variables.
(lld-11, lld-12): New variables.
(lld): Point to lld-11.
---
This patch is an alternative to the one sent by terramorpha.

Supposed advantages of it are:
* lld still points to lld-11, not breaking any packages that rely on it
* llvm-subprojects-origin can be reused by other LLVM subprojects
  (think of libcxx and libcxxabi, which both require each other, or
  libunwind, which requires libcxx)

Disadvantages are:
* llvm-project is a beefy tarball and somewhat of a pain to unpack
* Both this version and the original use an unclean approach to building
  subprojects, that is propagated by LLVM.  Perhaps we ought to instead
  clean up their mess?

Regards,
Leo

 gnu/packages/llvm.scm | 43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 575c63c713..1ddbd39e59 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -92,6 +92,22 @@ as \"x86_64-linux\"."
   (string-append "https://github.com/llvm/llvm-project/releases/download"
                  "/llvmorg-" version "/" component "-" version ".src.tar.xz"))
 
+(define* (llvm-subprojects-origin components version hash
+                                  #:optional (patches '()))
+  (origin
+    (method url-fetch)
+    (uri (llvm-uri "llvm-project" version))
+    (sha256 (base32 hash))
+    (patches (map search-patch patches))
+    (modules '((guix build utils)
+               (ice-9 ftw)))
+    (snippet
+     `(for-each
+       (lambda (file)
+         (unless (member file '("." ".." ,@components))
+           (delete-file-recursively file)))
+       (scandir ".")))))
+
 (define* (clang-runtime-from-llvm llvm hash
                                   #:optional (patches '()))
   (package
@@ -882,7 +898,7 @@ of programming tools as well as libraries with equivalent functionality.")
 (define-public clang clang-9)
 (define-public clang-toolchain clang-toolchain-9)
 
-(define-public lld
+(define-public lld-11
   (package
     (name "lld")
     (version "11.0.0")
@@ -906,6 +922,31 @@ of programming tools as well as libraries with equivalent functionality.")
 components which highly leverage existing libraries in the larger LLVM Project.")
     (license license:asl2.0))) ; With LLVM exception
 
+(define %llvm-project-12.0.0-hash "0a1n88dmbwp1ww7h3ykf0s001cndk1bm3i2cj1y2sh548f4nilcy")
+
+(define-public lld-12
+  (package
+    (inherit lld-11)
+    (version "12.0.0")
+    (source (llvm-subprojects-origin '("lld" "libunwind") version
+                                     %llvm-project-12.0.0-hash))
+    (arguments
+     `(,@(package-arguments lld-11)
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'dissect
+           (lambda _
+             ;; Find libunwind in unpacked sources
+             (substitute* "lld/MachO/CMakeLists.txt"
+               (("\\$\\{LLVM_MAIN_SRC_DIR\\}/\\.\\./libunwind")
+                (string-append (getcwd) "/libunwind")))
+             ;; chdir to actual source folder
+             (chdir "lld"))))))
+    (inputs
+     `(("llvm" ,llvm-12)))))
+
+(define-public lld lld-11)
+
 (define-public lldb
   (package
     (name "lldb")
-- 
2.32.0





Information forwarded to guix-patches <at> gnu.org:
bug#49471; Package guix-patches. (Mon, 19 Jul 2021 17:38:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 49471 <at> debbugs.gnu.org
Subject: Re: bug#49471: [PATCH] gnu: lld: Update to 12.0.0.
Date: Mon, 19 Jul 2021 19:37:28 +0200
Hi,

Leo Prikler <leo.prikler <at> student.tugraz.at> skribis:

> * gnu/packages/llvm.scm (llvm-subprojects-origin, %llvm-project-12.0.0-hash):
> New variables.
> (lld-11, lld-12): New variables.
> (lld): Point to lld-11.
> ---
> This patch is an alternative to the one sent by terramorpha.
>
> Supposed advantages of it are:
> * lld still points to lld-11, not breaking any packages that rely on it
> * llvm-subprojects-origin can be reused by other LLVM subprojects
>   (think of libcxx and libcxxabi, which both require each other, or
>   libunwind, which requires libcxx)
>
> Disadvantages are:
> * llvm-project is a beefy tarball and somewhat of a pain to unpack
> * Both this version and the original use an unclean approach to building
>   subprojects, that is propagated by LLVM.  Perhaps we ought to instead
>   clean up their mess?

I’m not sure that the 2nd point means, but perhaps it can be addressed
separately?

> -(define-public lld
> +(define-public lld-11
>    (package
>      (name "lld")
>      (version "11.0.0")

Does it make sense to keep old versions of the linker around?  To me
it’s much less useful than keeping old versions of the compiler.

> +(define %llvm-project-12.0.0-hash "0a1n88dmbwp1ww7h3ykf0s001cndk1bm3i2cj1y2sh548f4nilcy")
                                     ^
I’d use ‘base32’ here (for expansion-time base32 decoding) and remove it
from ‘llvm-subprojects-origin’.

Otherwise LGTM.

Thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#49471; Package guix-patches. (Mon, 19 Jul 2021 18:11:02 GMT) Full text and rfc822 format available.

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

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 49471 <at> debbugs.gnu.org
Subject: Re: bug#49471: [PATCH] gnu: lld: Update to 12.0.0.
Date: Mon, 19 Jul 2021 20:10:49 +0200
Hi,

Am Montag, den 19.07.2021, 19:37 +0200 schrieb Ludovic Courtès:
> Hi,
> 
> Leo Prikler <leo.prikler <at> student.tugraz.at> skribis:
> 
> > * gnu/packages/llvm.scm (llvm-subprojects-origin, %llvm-project-
> > 12.0.0-hash):
> > New variables.
> > (lld-11, lld-12): New variables.
> > (lld): Point to lld-11.
> > ---
> > This patch is an alternative to the one sent by terramorpha.
> > 
> > Supposed advantages of it are:
> > * lld still points to lld-11, not breaking any packages that rely
> > on it
> > * llvm-subprojects-origin can be reused by other LLVM subprojects
> >   (think of libcxx and libcxxabi, which both require each other, or
> >   libunwind, which requires libcxx)
> > 
> > Disadvantages are:
> > * llvm-project is a beefy tarball and somewhat of a pain to unpack
> > * Both this version and the original use an unclean approach to
> > building
> >   subprojects, that is propagated by LLVM.  Perhaps we ought to
> > instead
> >   clean up their mess?
> 
> I’m not sure that the 2nd point means, but perhaps it can be
> addressed separately?
The gist of it is that we can't build the projects from just their
source and "normal" inputs – we have to also unpack (or leave in the
source tree as done here) other sources, that would themselves
constitute different packages.

I'm not really sure how big of a problem that is in general (apart from
the annoyance of having to do that) – it simply feels unclean, that's
all I'm complaining about here.

> > -(define-public lld
> > +(define-public lld-11
> >    (package
> >      (name "lld")
> >      (version "11.0.0")
> 
> Does it make sense to keep old versions of the linker around?  To me
> it’s much less useful than keeping old versions of the compiler.

There don't seem to be dependants other than itself, but I didn't want
to accidentally break stuff, also concerning other channels.  Since
lld-12 will be used in the zig package thereafter, which takes
versioned LLVM as inputs, I think it's likely similar projects might
want to use lld 11 or older, which can be built by inheriting the
somewhat simpler lld-11 package.  (Similarly if you want zig 0.7 for
historical purposes, although that's entering Guix Past territory.)

> > +(define %llvm-project-12.0.0-hash
> > "0a1n88dmbwp1ww7h3ykf0s001cndk1bm3i2cj1y2sh548f4nilcy")
>                                      ^
> I’d use ‘base32’ here (for expansion-time base32 decoding) and remove
> it from ‘llvm-subprojects-origin’.
Point taken, I'll update that in v2.

Regards,
Leo





Reply sent to Sarah Morgensen <iskarian <at> mgsn.dev>:
You have taken responsibility. (Fri, 24 Sep 2021 00:29:02 GMT) Full text and rfc822 format available.

Notification sent to terramorpha <at> cock.li:
bug acknowledged by developer. (Fri, 24 Sep 2021 00:29:02 GMT) Full text and rfc822 format available.

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

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: 49471-done <at> debbugs.gnu.org
Subject: Re: [bug#49471] [PATCH] gnu: lld: Update to 12.0.0.
Date: Thu, 23 Sep 2021 17:28:39 -0700
Hi,

terramorpha <at> cock.li writes:

> Hi guix. While updating my personal package definition of zig to 0.8.0, I had to
> write one for lld <at> 12 too.
> (IIUC, only llvm and clang were upgraded to 12, I couldn't find lld when `guix
> search`-ing)
>
> Anyway, the release tarball assumes that it will be unpacked and built in the
> same directory as the libunwind source.
> This is why at build time, I added a phase to patch the CMakeLists.txt and make
> it look for libunwind in a specific place.
>
> Cheers

It looks like this has been done in

  a7283c1d14 gnu: lld: Update to 12.0.1.

on master, so I'm closing this bug.

--
Sarah




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 22 Oct 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 184 days ago.

Previous Next


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