guix build u-boot-pinebook --with-git-url failed due to "source" in C_INCLUDE_PATH

  • Done
  • quality assurance status badge
Details
3 participants
  • 宋文武
  • Ludovic Courtès
  • Maxim Cournoyer
Owner
unassigned
Submitted by
宋文武
Severity
normal

Debbugs page

宋文武 wrote 4 years ago
(address . bug-guix@gnu.org)
TYAP286MB018562975536727DAE1128FCA3F70@TYAP286MB0185.JPNP286.PROD.OUTLOOK.COM
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".

I think we should filter out "source" in `set-paths` of the
`gnu-build-system`.
Ludovic Courtès wrote 4 years ago
(name . 宋文武)(address . iyzsong@outlook.com)(address . 44924@debbugs.gnu.org)
87mtyuddyc.fsf@gnu.org
Hi,

宋文武 <iyzsong@outlook.com> skribis:

Toggle quote (9 lines)
> 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’?

Toggle quote (3 lines)
> 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’.

Thanks,
Ludo’.
宋文武 wrote 4 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 44924@debbugs.gnu.org)
TYAP286MB01854DDDE3EAA98E87C7F6E2A3F00@TYAP286MB0185.JPNP286.PROD.OUTLOOK.COM
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (15 lines)
> Hi,
>
> 宋文武 <iyzsong@outlook.com> 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".

Toggle quote (6 lines)
>
>> 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?= <iyzsong@member.fsf.org>
Date: Sat, 5 Dec 2020 11:35:37 +0800
Subject: [PATCH] build-system/gnu: Remove the source directory from search
paths.


* 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(-)

Toggle diff (17 lines)
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!
Ludovic Courtès wrote 4 years ago
(name . 宋文武)(address . iyzsong@outlook.com)(address . 44924@debbugs.gnu.org)
87mtyq0yqi.fsf@gnu.org
Hi,

宋文武 <iyzsong@outlook.com> skribis:

Toggle quote (14 lines)
> From 77283132c6eeeb75900afad5782b989ceee1506a Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@member.fsf.org>
> 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(-)

LGTM!

You can push it right away to ‘core-updates’, but since it triggers a
full rebuild, now’s a good time to push another change that triggers a
full rebuild. :-)

Thanks,
Ludo’.
宋文武 wrote 4 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 44924-done@debbugs.gnu.org)
TYAP286MB01859B8EC95593E703B9FE11A3CE0@TYAP286MB0185.JPNP286.PROD.OUTLOOK.COM
Toggle quote (7 lines)
> LGTM!
>
> You can push it right away to ‘core-updates’, but since it triggers a
> full rebuild, now’s a good time to push another change that triggers a
> full rebuild. :-)
>

Pushed bravely, thank you!
Closed
Maxim Cournoyer wrote 2 years ago
874ju89edb.fsf@gmail.com
unarchive 44924
reopen 44924
thanks

Hello!

宋文武 <iyzsong@outlook.com> writes:


[...]

Toggle quote (31 lines)
> 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?= <iyzsong@member.fsf.org>
> 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:

Toggle snippet (18 lines)
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.

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

--
Thanks,
Maxim
Maxim Cournoyer wrote 2 years ago
[PATCH v2 core-updates] build: gnu-build-system: Remove source from native inputs.
(name . 宋文武)(address . iyzsong@outlook.com)
87zgbz9ajg.fsf_-_@gmail.com
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 <maxim.cournoyer@gmail.com>
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(-)

Toggle diff (33 lines)
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
Maxim Cournoyer wrote 2 years ago
Re: bug#44924: guix build u-boot-pinebook --with-git-url failed due to "source" in C_INCLUDE_PATH
(name . 宋文武)(address . iyzsong@outlook.com)
87o7sf8dzb.fsf_-_@gmail.com
Hello,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (5 lines)
> Hi again,
>
> Here's a v2, which guards against a #f native-inputs (when no
> cross-compiling).

Pushed to core-updates with commit 6454208222.

Closing!

--
Thanks,
Maxim
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 44924@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 44924
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help