Subject: Re: bug#44924: guix build u-boot-pinebook --with-git-url failed due to "source" in C_INCLUDE_PATH

From: Maxim Cournoyer <[email-masked]>
Date: Tue, 06 Dec 2022 20:44:32 -0500

unarchive 44924
reopen 44924
thanks

Hello!

宋文武 <[email-masked]> writes:

[...]

> Here is patch:
>
>>>From 77283132c6eeeb75900afad5782b989ceee1506a Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <[email-masked]>
> Date: Sat, 5 Dec 2020 11:35:37 +0800
> Subject: [PATCH] build-system/gnu: Remove the source directory from search
>  paths.
>
> Fixes <https://issues.guix.gnu.org/44924>.
>
> * guix/build/gnu-build-system.scm (set-paths): Delete 'source' from
> 'input-directories'.
> ---
>  guix/build/gnu-build-system.scm | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
> index 5f08b9d6ac..f9e6f5013d 100644
> --- a/guix/build/gnu-build-system.scm
> +++ b/guix/build/gnu-build-system.scm
> @@ -72,7 +72,9 @@ See https://reproducible-builds.org/specs/source-date-epoch/."
>                      (search-paths '()) (native-search-paths '())
>                      #:allow-other-keys)
>    (define input-directories
> -    (match inputs
> +    ;; The "source" input can be a directory, but we don't want it for search
> +    ;; paths.  See <https://issues.guix.gnu.org/44924>.
> +    (match (alist-delete "source" inputs)
>        (((_ . dir) ...)
>         dir)))

I've rediscovered this same bug, but when cross-compiling.  The same fix
needs to be applied to the native-inputs in this context, as this is
where the "source" is:

--8<---------------cut here---------------start------------->8---
modified   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 (alist-delete "source" native-inputs)
       (((_ . dir) ...)
        dir)
-      (#f                                         ; not cross compiling
+      (#f                               ;not cross-compiling
        '())))
 
   ;; Tell 'ld-wrapper' to disallow non-store libraries.
--8<---------------cut here---------------end--------------->8---

If that looks OK, I'll push it to core-updates.

-- 
Thanks,
Maxim