GNU bug report logs - #54239
[PATCH] gnu: Add cross-clang.

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Thu, 3 Mar 2022 16:04:02 UTC

Severity: normal

Tags: patch

Full log


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

From: Julien Lepiller <julien <at> lepiller.eu>
To: 54239 <at> debbugs.gnu.org
Subject: [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





This bug report was last modified 3 years and 29 days ago.

Previous Next


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