unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Christopher Baines <mail@cbaines.net>
Cc: help-guix@gnu.org
Subject: Re: Using the Guile json module in a gexp
Date: Mon, 11 Sep 2017 14:12:34 +0200	[thread overview]
Message-ID: <87377ta0y5.fsf@gnu.org> (raw)
In-Reply-To: <20170911075841.13e75eb9@cbaines.net> (Christopher Baines's message of "Mon, 11 Sep 2017 07:58:41 +0100")

Hello!

Christopher Baines <mail@cbaines.net> skribis:

> So I'm having some trouble using the Guile json module in a gexp.
> I've added (with-imported-modules '((json)) ...), and the
> module-import-compiled builder crashes.
>
> Backtrace:
>            4 (primitive-load "/gnu/store/35zv0m9wwd2nz3agyywv09d3k5v?")
> In srfi/srfi-1.scm:
>     640:9  3 (for-each #<procedure c10700 at ice-9/eval.scm:333:13 ?> ?)
> In ice-9/eval.scm:
>    245:16  2 (_ #(#(#<directory (guix build utils) 83f6e0> "/gn?") #))
> In ice-9/boot-9.scm:
>   1519:24  1 (_ "./json.scm")
> In unknown file:
>            0 (stat "./json.scm" #<undefined>)
>
> ERROR: In procedure stat:
> ERROR: In procedure stat: No such file or directory: "./json.scm"

This would have the effect of importing the (json) module of the host
environment into the build environment, which is not desirable for a
couple of reasons:

  1. It would require having Guile-JSON installed in the host
     environment, and the right version of it.

  2. It would hinder reproducibility since different users may have
     different Guile-JSON variants installed on the host side.

To overcome this, you have to do like (guix scripts package) does:

  #~(begin
      (add-to-load-path #$(file-append guile-json
                                       "/share/guile/site/"
                                       (effective-version)))
      …)

It would be nice to simplify this somehow, though.

HTH!

Ludo’.

  reply	other threads:[~2017-09-11 12:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11  6:58 Using the Guile json module in a gexp Christopher Baines
2017-09-11 12:12 ` Ludovic Courtès [this message]
2017-09-12 18:49   ` Christopher Baines

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=87377ta0y5.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=help-guix@gnu.org \
    --cc=mail@cbaines.net \
    /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.
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).