guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54239] [PATCH v3 02/10] gnu: clang-runtime: Fix cross-compilation.


From: Julien Lepiller
Subject: [bug#54239] [PATCH v3 02/10] gnu: clang-runtime: Fix cross-compilation.
Date: Sat, 16 Jul 2022 21:47:59 +0200

* gnu/packages/llvm.scm (clang-runtime-from-llvm): Sanitie
  CROSS_CPLUS_INCLUDE_PATH in the same way as CPLUS_INCLUDE_PATH.
---
 gnu/packages/llvm.scm | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 5a2f411eb2..6428391650 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -141,7 +141,7 @@ (define* (clang-runtime-from-llvm llvm
                     ;; Work around https://issues.guix.info/issue/36882.  We 
need to
                     ;; remove glibc from CPLUS_INCLUDE_PATH so that the one 
hardcoded
                     ;; in GCC, at the bottom of GCC include search-path is 
used.
-                    (lambda* (#:key inputs #:allow-other-keys)
+                    (lambda* (#:key inputs target #:allow-other-keys)
                       (let* ((filters '("libc"))
                              (input-directories
                               (filter-map (lambda (input)
@@ -153,7 +153,20 @@ (define* (clang-runtime-from-llvm llvm
                         (set-path-environment-variable "CPLUS_INCLUDE_PATH"
                                                        '("include")
                                                        input-directories)
-                        #t))))))
+                        (when target
+                          (let ((libc (assoc-ref inputs "cross-libc")))
+                            (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                              (string-join
+                                (filter
+                                  (lambda (path)
+                                    (and
+                                      (not (equal? path
+                                                   (string-append libc 
"/include")))
+                                      (string-suffix? "include" path)))
+
+                                  (string-split (getenv 
"CROSS_CPLUS_INCLUDE_PATH")
+                                                #\:))
+                                           ":"))))))))))
     (home-page "https://compiler-rt.llvm.org";)
     (synopsis "Runtime library for Clang/LLVM")
     (description
-- 
2.37.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]