unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: "Jakob L. Kreuze" <zerodaysfordays@sdf.lonestar.org>
Cc: 36813@debbugs.gnu.org
Subject: bug#36813: 'lower-gexp' does not respect 'system' or 'target' keywords
Date: Fri, 26 Jul 2019 10:21:47 +0200	[thread overview]
Message-ID: <87ftmtqk84.fsf@gnu.org> (raw)
In-Reply-To: <87imrp3ddy.fsf@sdf.lonestar.org> (Jakob L. Kreuze's message of "Thu, 25 Jul 2019 19:25:45 -0400")

Hello Jakob,

zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) skribis:

> I believe there is an issue with 'lower-gexp'. Running the following
> snippet to lower a G-Expression for "i686-linux" yields output that
> references store paths built for x86_64. In this case, the Guile
> interpreter used is an x86_64 binary.
>
> #+BEGIN_SRC scheme
> (define (display-exp exp)
>   (mlet* %store-monad ((lowered (lower-gexp exp
>                                             #:system "i686-linux"
>                                             #:target "i686-linux"))
>                        (to-build -> (cons (lowered-gexp-guile lowered)
>                                           (lowered-gexp-inputs lowered)))
>                        (_ (built-derivations to-build)))
>     (return (format #t "~a~%" (lowered-gexp-sexp lowered)))))
>
> (with-store store
>   (run-with-store store
>     (display-exp #~(primitive-load #$(switch-system-program %system)))))
> #+END_SRC

Note: #:target must be a “GNU triplet” like “arm-linux-gnueabihf”, not a
system type like “i686-linux”.

> jakob@Epsilon ~ $ guile ~/test.scm 
> (primitive-load /gnu/store/v7v1b7375j9j82dvfycv56v36nv5jq3y-switch-to-system.scm)
> jakob@Epsilon ~ $ cat /gnu/store/v7v1b7375j9j82dvfycv56v36nv5jq3y-switch-to-system.scm
> #!/gnu/store/9alic3caqhay3h8mx4iihpmyj6ymqpcx-guile-2.2.4/bin/guile --no-auto-compile
> !#
> ...
> jakob@Epsilon ~ $ file /gnu/store/9alic3caqhay3h8mx4iihpmyj6ymqpcx-guile-2.2.4/bin/guile
> /gnu/store/9alic3caqhay3h8mx4iihpmyj6ymqpcx-guile-2.2.4/bin/guile: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped

That’s because the Guile used here comes from the #:guile-for-build
parameter.

So the caller is responsible for doing the right thing here.  In fact,
if you do:

  (lower-gexp exp #:system whatever #:guile-for-build #f)

it will automatically take care of computing the right Guile for this
system.  For consistency, I don’t think we should change the default,
though.

WDYT?

Thanks,
Ludo’.

  reply	other threads:[~2019-07-26  8:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 23:25 bug#36813: 'lower-gexp' does not respect 'system' or 'target' keywords Jakob L. Kreuze
2019-07-26  8:21 ` Ludovic Courtès [this message]
2019-07-26 14:30   ` Jakob L. Kreuze
2019-07-26 15:28     ` Ludovic Courtès
2019-07-26 15:37       ` Jakob L. Kreuze
2019-07-26 15:41         ` Jakob L. Kreuze
2019-07-26 23:09           ` Ludovic Courtès
2019-07-27 17:47             ` Jakob L. Kreuze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftmtqk84.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=36813@debbugs.gnu.org \
    --cc=zerodaysfordays@sdf.lonestar.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).