Hi again,

Here's a v2, which guards against a #f native-inputs (when no
cross-compiling).

>From 8d2f8fafb66288969f41fcab7705de65f6d09432 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <[email protected]>
Date: Tue, 6 Dec 2022 20:44:54 -0500
Subject: [PATCH] build: gnu-build-system: Remove source from native inputs.

Fixes <https://issues.guix.gnu.org/44924>, in a cross-compilation context.

Having the source in inputs when computing search paths can break builds.  One
example is a git checkout of the Linux source tree, where the source (a
directory) 'include' subdirectory gets picked up in C_INCLUDE_PATH and causes
conflicts with the includes provided by glibc.

* guix/build/gnu-build-system2.scm (set-paths): Remove any "source" native
input.
---
 guix/build/gnu-build-system2.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/guix/build/gnu-build-system2.scm b/guix/build/gnu-build-system2.scm
index 54129549c2..1766f9d474 100644
--- a/guix/build/gnu-build-system2.scm
+++ b/guix/build/gnu-build-system2.scm
@@ -83,10 +83,12 @@ (define input-directories
        dir)))
 
   (define native-input-directories
-    (match native-inputs
+    ;; When cross-compiling, the source appears in native-inputs rather than
+    ;; inputs.
+    (match (and=> native-inputs (cut alist-delete "source" <>))
       (((_ . dir) ...)
        dir)
-      (#f                                         ; not cross compiling
+      (#f                               ;not cross-compiling
        '())))
 
   ;; Tell 'ld-wrapper' to disallow non-store libraries.

base-commit: b94724e8b2102be0fe9d19e9dfe44d6f7101bd4b
prerequisite-patch-id: ef7cada25908a9dec368cede7033b0fe6869ac97
prerequisite-patch-id: 660177fb9eee55d11983ea9360c072730d0d21a5
prerequisite-patch-id: 3af7d5aabc4b70d4709fcb150f072ae1ff16a859
prerequisite-patch-id: fd4074fb4cf068ccac3122c19138f098a610542a
prerequisite-patch-id: 51cecbabc04c69d4338addaece536c42a075660f
prerequisite-patch-id: 98e04821d56efe50aeb9bdcf640c25bebc2823c6
prerequisite-patch-id: b9b6f21a2db3f7a5ef82bb11ed23f69749cc6b3d
prerequisite-patch-id: 2c67bfd85b343a65440e6c63451e5417129dea6f
prerequisite-patch-id: a4a0de47739cb0fa71f5c3fd60ba31164a631812
prerequisite-patch-id: cc499b2ffd8c21315cd3760ed4107afc25b3f632
-- 
2.38.1

-- 
Thanks,
Maxim

Reply via email to