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

From: 宋文武 <[email-masked]>
Date: Sat, 05 Dec 2020 11:50:01 +0800

Ludovic Courtès <[email-masked]> writes:

> Hi,
>
> 宋文武 <[email-masked]> skribis:
>
>> Running:
>>   guix build u-boot-pinebook \
>>     --with-git-url=u-boot-pinebook=https://github.com/u-boot/u-boot
>>
>> Would fail with "fatal error: asm/string.h: No such file or directory".
>>
>> And it's caused by the first entry in C_INCLUDE_PATH, which is
>> "/gnu/store/xxx-u-boot-xxx/include".
>
> Why don’t we have that problem when omitting ‘--with-git-url’?

When not use git, source is a tarball, not a directory, so it's ignored
by "set-paths".

>
>> I think we should filter out "source" in `set-paths` of the
>> `gnu-build-system`.
>
> Yes, sounds like a good idea.  We can do it in ‘core-updates’.

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)))
 
-- 
2.29.1

Thanks!