GNU bug report logs -
#59843
[PATCH] shell: Enable --target for guix shell (--development)
Previous Next
Reported by: Yarl Baudig <yarl-baudig <at> mailoo.org>
Date: Mon, 5 Dec 2022 20:32:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59843 in the body.
You can then email your comments to 59843 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#59843
; Package
guix-patches
.
(Mon, 05 Dec 2022 20:32:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yarl Baudig <yarl-baudig <at> mailoo.org>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Mon, 05 Dec 2022 20:32:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This enable the use of --target for development inputs, that is:
with `guix shell`, includes the dependencies for cross-building packages
given with --development
* guix/scripts/environment.scm: Enable --target.
* guix/scripts/shell.scm: Enable --target.
* doc/guix.texi: Document it.
---
doc/guix.texi | 5 +++++
guix/scripts/environment.scm | 14 +++++++++++---
guix/scripts/shell.scm | 3 +++
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index a79b777826..f1da3a4865 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -6176,6 +6176,11 @@ environment.
@itemx -s @var{system}
Attempt to build for @var{system}---e.g., @code{i686-linux}.
+@item --target=@var{target}
+Attempt to build the environment dependencies (see @option{--development})
+for @var{target}--e.g., @code{aarch64-linux-gnu}. Useful to debug cross-build
+failures (@pxref{Debugging Build Failures}).
+
@item --container
@itemx -C
@cindex container
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 64597f6e9f..b269be828e 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -127,7 +127,9 @@ (define (show-environment-options-help)
(display (G_ "
-v, --verbosity=LEVEL use the given verbosity LEVEL"))
(display (G_ "
- --bootstrap use bootstrap binaries to build the environment")))
+ --bootstrap use bootstrap binaries to build the environment"))
+ (display (G_ "
+ --list-targets list available targets")))
(define (show-help)
(display (G_ "Usage: guix environment [OPTION]... PACKAGE... [-- COMMAND...]
@@ -144,6 +146,10 @@ (define (show-help)
--ad-hoc include all specified packages in the environment instead
of only their inputs"))
+ (display (G_ "
+ --target=TRIPLET cross-build inputs for non-adhoc packages for
+ TRIPLET--e.g., \"aarch64-linux-gnu\""))
+
(show-environment-options-help)
(newline)
(show-build-options-help)
@@ -277,7 +283,8 @@ (define %options
(append %transformation-options
%standard-build-options
- %standard-native-build-options)))
+ %standard-native-build-options
+ %standard-cross-build-options)))
(define (pick-all alist key)
"Return a list of values in ALIST associated with KEY."
@@ -332,7 +339,8 @@ (define (packages->outputs packages mode)
(('package 'package (? string? spec))
(manifest-entries
(package->development-manifest
- (transform (specification->package+output spec)))))
+ (transform (specification->package+output spec))
+ #:target (assoc-ref opts 'target))))
(('expression mode str)
;; Add all the outputs of the package STR evaluates to.
(packages->outputs (read/eval str) mode))
diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm
index 2fc1dc942a..b2ae12cec2 100644
--- a/guix/scripts/shell.scm
+++ b/guix/scripts/shell.scm
@@ -62,6 +62,9 @@ (define (show-help)
(display (G_ "
-f, --file=FILE add to the environment the package FILE evaluates to"))
+ (display (G_ "
+ --target=TRIPLET cross-build development inputs packages for
+ TRIPLET--e.g., \"aarch64-linux-gnu\""))
(display (G_ "
-q inhibit loading of 'guix.scm' and 'manifest.scm'"))
(display (G_ "
base-commit: c3713d53e0bdf1186e08880b9e0ae6dd85f55fc4
--
2.38.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#59843
; Package
guix-patches
.
(Wed, 14 Dec 2022 11:00:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 59843 <at> debbugs.gnu.org (full text, mbox):
Hi,
Yarl Baudig <yarl-baudig <at> mailoo.org> skribis:
> This enable the use of --target for development inputs, that is:
> with `guix shell`, includes the dependencies for cross-building packages
> given with --development
>
> * guix/scripts/environment.scm: Enable --target.
> * guix/scripts/shell.scm: Enable --target.
> * doc/guix.texi: Document it.
This change won’t give something useful per se, because the environment
will contain a mixture of “host” and “build” inputs.
To make it work, we need two profiles: one for “build” inputs, and one
for “host/target” inputs. Search path environment variables must be
evaluated in a way that accounts for these two profiles. For example,
target libraries will appear on CROSS_C_INCLUDE_PATH but not on
C_INCLUDE_PATH.
Does that make sense?
IOW, it’s a trickier endeavor that one could hope for. :-)
Thanks,
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#59843
; Package
guix-patches
.
(Wed, 14 Dec 2022 16:28:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 59843 <at> debbugs.gnu.org (full text, mbox):
>
> This change won’t give something useful per se, because the environment
> will contain a mixture of “host” and “build” inputs.
>
> To make it work, we need two profiles: one for “build” inputs, and one
> for “host/target” inputs. Search path environment variables must be
> evaluated in a way that accounts for these two profiles. For example,
> target libraries will appear on CROSS_C_INCLUDE_PATH but not on
> C_INCLUDE_PATH.
>
> Does that make sense?
>
> IOW, it’s a trickier endeavor that one could hope for. :-)
>
> Thanks,
> Ludo’.
>
Obviously, you know a lot more about this than I do. However (please correct me, I probably did not completely understand your point) I think it is useful and works for the goal I mentioned in the part of the patch concerning the manual. It can help debugging failing (cross-)builds because you source "environment-variables" and that's the reason why I sent this patch. I tried it with texinfo (because the cross-compilation fails and I want to fix it) and it seem to work (i.e. you have access to paths in CROSS_C_INCLUDE_PATH, for example). Maybe I missed something and you saw that "debugging cross-builds" is my intent. Please do tell.
I take avantage of having reached you to mention https://issues.guix.gnu.org/59839 I was working on this in parallel and I may have made things confusing because (in 59839) that's --system I am talking about (see the last version, number 3, of the patch please)... Thank you a lot.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#59843
; Package
guix-patches
.
(Wed, 14 Dec 2022 20:58:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 59843 <at> debbugs.gnu.org (full text, mbox):
I responded too fast. You are right, something is wrong. Not every path is accessible. I will try to understand when I'll have some time.
---- Message d'origine ----
> De : Ludovic Courtès <ludo <at> gnu.org>
> À : Yarl Baudig <yarl-baudig <at> mailoo.org>
> Sujet : Re: bug#59843: [PATCH] shell: Enable --target for guix shell (--development)
> Date : 14/12/2022 11:59:31 Europe/Paris
> Copie à : 59843 <at> debbugs.gnu.org
>
> Hi,
>
> Yarl Baudig <yarl-baudig <at> mailoo.org> skribis:
>
> > This enable the use of --target for development inputs, that is:
> > with `guix shell`, includes the dependencies for cross-building packages
> > given with --development
> >
> > * guix/scripts/environment.scm: Enable --target.
> > * guix/scripts/shell.scm: Enable --target.
> > * doc/guix.texi: Document it.
>
> This change won’t give something useful per se, because the environment
> will contain a mixture of “host” and “build” inputs.
>
> To make it work, we need two profiles: one for “build” inputs, and one
> for “host/target” inputs. Search path environment variables must be
> evaluated in a way that accounts for these two profiles. For example,
> target libraries will appear on CROSS_C_INCLUDE_PATH but not on
> C_INCLUDE_PATH.
>
> Does that make sense?
>
> IOW, it’s a trickier endeavor that one could hope for. :-)
>
> Thanks,
> Ludo’.
>
Reply sent
to
Ludovic Courtès <ludo <at> gnu.org>
:
You have taken responsibility.
(Wed, 21 Dec 2022 13:43:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Yarl Baudig <yarl-baudig <at> mailoo.org>
:
bug acknowledged by developer.
(Wed, 21 Dec 2022 13:43:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 59843-done <at> debbugs.gnu.org (full text, mbox):
Hi,
"yarl baudig" <yarl-baudig <at> mailoo.org> skribis:
> I responded too fast. You are right, something is wrong. Not every path is accessible. I will try to understand when I'll have some time.
Alright! I’m closing this bug for now, but do get in touch on IRC or
guix-devel if you’d like to discuss it.
Thanks,
Ludo’.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 19 Jan 2023 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 91 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.