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-system.scm (set-paths): Remove any "source" native
input.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Maxim Cournoyer 2022-12-06 20:44:54 -05:00
parent f27d4c9a78
commit 6454208222
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 4 additions and 2 deletions

View File

@ -83,10 +83,12 @@ there are none."
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.