diff mbox series

[bug#54239,v2,5/5] gnu: Add libcxxabi-9.

Message ID 937fd2ca36d8368ea83be56ae29dbec1a97bfb41.1646387919.git.julien@lepiller.eu
State New
Headers show
Series [bug#54239,v2,1/5] gnu: Add cross-llvm. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Julien Lepiller March 4, 2022, 9:59 a.m. UTC
* gnu/packages/llvm.scm (libcxxabi-9): New variable.
(libcxxabi-6): Inherit from it.
---
 gnu/packages/llvm.scm | 69 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 51 insertions(+), 18 deletions(-)

Comments

M March 4, 2022, 7:50 p.m. UTC | #1
Julien Lepiller schreef op vr 04-03-2022 om 10:59 [+0100]:
> +     (list (if (%current-target-system)
> +               (cross-clang (%current-target-system) #:clang clang-6)
> +               clang-6)))))

Could the new procedure could 'clang-for-target' be used here?
Likewise for a few other packages (e.g. hedgewards), but those could be
left for future patches.

Greetings,
Maxime
Ludovic Courtès May 21, 2022, 1:41 p.m. UTC | #2
Hello Julien and all,

Looks like quite a lot of work has gone into this patch series.  What’s
the status?  It would be nice to push it past the finish line!

TIA,
Ludo’.
Julien Lepiller July 16, 2022, 7:44 p.m. UTC | #3
So, I tried using only a wrapper around clang to pass --target.
However, this doesn't seem to be enough: the code disables LIBRARY_PATH
when cross-compiling and it picks up the wrong gcc:lib and libc
headers.

Instead, I tried to improve the previous patches, and here is v3. To
reply (maybe again) to remarks on the previous version:

- no it's not necessary to build a specific llvm package, but that way
  we make sure that the default target is the one we want, so we don't
  have to change the instructions for packages that use it, or to use a
  wrapper to pass the --target argument.  Maybe a wrapper could work
  better though.
- clang-for-target was added in the patch that adds cross-clang.
- the configure flags are now a gexp
- I kept the substitute for "/lib64/ld-linux-x86-64.so.2", it's the
  same instructions as in clang, so I prefer not to change it. It's a
  bit sad that we'll have to change in both places if needed :/
- (gnu packages cross-base) is autoloaded now
- I'll leave documenting limitations of package-with-c-toolchain (or
  improving it) to another time.
- I have no idea how to make it work for wasm, but that can probably be
  fixed another time. Also, it's not listed in supported targets, and
  guix doesn't let me build for that target anymore.
- Fixed build issues for clang >=10.

I also agree that clang-runtime should be cross-compiled. It is a
propagated-input, but cross-clang is a native package that is a
cross-compiler for another architecture, so the inputs are native too.

Since I couldn't figure out how to make a package for a given target, I
added a transformation to (guix build-system) that replaces the
keywords to force a package to build for a given architecture.

Also, I added libcxx and libcxxabi 12 at the end because I need them
for the newer versions of android tools.
M July 19, 2022, 7:54 p.m. UTC | #4
On 16-07-2022 21:44, Julien Lepiller wrote:
> Since I couldn't figure out how to make a package for a given target, I
> added a transformation to (guix build-system) that replaces the
> keywords to force a package to build for a given architecture.


Try:

scheme@(guix-user)> ,build (with-parameters ((%current-target-system 
"aarch64-linux-gnu")) (specification->package "hello"))

[...]

$3 = "/gnu/store/rys78r4j72zh45xchq87x2y30ya8mzvi-hello-2.12.1"

Greetings,

Maxime.
Julien Lepiller July 19, 2022, 8:42 p.m. UTC | #5
Le Tue, 19 Jul 2022 21:54:16 +0200,
Maxime Devos <maximedevos@telenet.be> a écrit :

> On 16-07-2022 21:44, Julien Lepiller wrote:
> > Since I couldn't figure out how to make a package for a given
> > target, I added a transformation to (guix build-system) that
> > replaces the keywords to force a package to build for a given
> > architecture.  
> 
> 
> Try:
> 
> scheme@(guix-user)> ,build (with-parameters ((%current-target-system 
> "aarch64-linux-gnu")) (specification->package "hello"))
> 
> [...]
> 
> $3 = "/gnu/store/rys78r4j72zh45xchq87x2y30ya8mzvi-hello-2.12.1"
> 
> Greetings,
> 
> Maxime.
> 

Thanks, that was a lot easier than I thought. So I removed the first
patch and changed to (with-parameters ((%current-target-system target))
base) in cross-clang.
diff mbox series

Patch

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index e00e92aa8c..47fd8e2442 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1407,20 +1407,17 @@  (define-public libcxx-6
          "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
     (inputs (list llvm-6))))
 
-(define-public libcxxabi-6
+(define-public libcxxabi-9
   (package
     (name "libcxxabi")
-    (version "6.0.1")
+    (version (package-version clang-9))
     (source
      (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/llvm/llvm-project")
-             (commit (string-append "llvmorg-" version))))
-       (file-name (git-file-name name version))
+       (method url-fetch)
+       (uri (llvm-uri "libcxxabi" version))
        (sha256
         (base32
-         "0ki6796b5z08kh3a3rbysr5wwb2dkl6wal5dzd03i4li5xfkvx1g"))))
+         "1b4aiaa8cirx52vk2p5kfk57qmbqf1ipb4nqnjhdgqps9jm7iyg8"))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags
@@ -1431,8 +1428,6 @@  (define-public libcxxabi-6
              "-DCMAKE_CXX_COMPILER=clang++")
        #:phases
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
-         (add-after 'unpack 'chdir
-           (lambda _ (chdir "libcxxabi")))
          (add-after 'unpack 'adjust-CPLUS_INCLUDE_PATH
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (define (delete* what lst)
@@ -1466,10 +1461,10 @@  (define-public libcxxabi-6
                                         (string-append gcc "/include/c++"))
                                   (string-split (getenv "CROSS_CPLUS_INCLUDE_PATH")
                                                 #\:)))
-                          ":"))
-                 (format #true
-                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
-                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
+                          ":")))
+               (format #true
+                       "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
+                       (getenv "CROSS_CPLUS_INCLUDE_PATH"))
                (format #true
                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
                        (getenv "CPLUS_INCLUDE_PATH")))))
@@ -1477,10 +1472,15 @@  (define-public libcxxabi-6
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((include-dir (string-append
                                  (assoc-ref outputs "out") "/include")))
-               (install-file "../libcxxabi/include/__cxxabi_config.h" include-dir)
-               (install-file "../libcxxabi/include/cxxabi.h" include-dir)))))))
-    (inputs (list llvm-6 libcxx-6))
-    (native-inputs (list (clang-for-target clang-6)))
+               (mkdir-p include-dir)
+               (install-file ,(string-append "../libcxxabi-" version
+                                             ".src/include/__cxxabi_config.h")
+                             include-dir)
+               (install-file ,(string-append "../libcxxabi-" version
+                                             ".src/include/cxxabi.h")
+                             include-dir)))))))
+    (inputs (list llvm-9 libcxx))
+    (native-inputs (list (clang-for-target clang-9)))
     (home-page "https://libcxxabi.llvm.org")
     (synopsis "C++ standard library support")
     (description
@@ -1488,6 +1488,39 @@  (define-public libcxxabi-6
 standard C++ library.")
     (license license:expat)))
 
+(define-public libcxxabi-6
+  (package
+    (inherit libcxxabi-9)
+    (name "libcxxabi")
+    (version "6.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/llvm/llvm-project")
+             (commit (string-append "llvmorg-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ki6796b5z08kh3a3rbysr5wwb2dkl6wal5dzd03i4li5xfkvx1g"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments libcxxabi-9)
+      ((#:phases phases)
+       `(modify-phases ,phases
+          (add-after 'unpack 'chdir
+            (lambda _ (chdir "libcxxabi")))
+          (replace 'install-headers
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((include-dir (string-append
+                                  (assoc-ref outputs "out") "/include")))
+                (install-file "../libcxxabi/include/__cxxabi_config.h" include-dir)
+                (install-file "../libcxxabi/include/cxxabi.h" include-dir))))))))
+    (inputs (list llvm-6 libcxx-6))
+    (native-inputs
+     (list (if (%current-target-system)
+               (cross-clang (%current-target-system) #:clang clang-6)
+               clang-6)))))
+
 (define-public libcxx+libcxxabi-6
   (package
     (inherit libcxx-6)