all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using the Guile json module in a gexp
@ 2017-09-11  6:58 Christopher Baines
  2017-09-11 12:12 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Baines @ 2017-09-11  6:58 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

Hey,

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"


The builder doesn't call stat directly, the stack trace gives line
numbers within other code, and its infeasible to add debugging mesasges
to the builder, as that requires rebuilding the world (at least with
the way I am running it).

I'll try and see if I can evaluate the same code outside of the
derivation to track down where it's calling stat, but let me know if
you can see what is going wrong.

Thanks,

Chris

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using the Guile json module in a gexp
  2017-09-11  6:58 Using the Guile json module in a gexp Christopher Baines
@ 2017-09-11 12:12 ` Ludovic Courtès
  2017-09-12 18:49   ` Christopher Baines
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-09-11 12:12 UTC (permalink / raw)
  To: Christopher Baines; +Cc: help-guix

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’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using the Guile json module in a gexp
  2017-09-11 12:12 ` Ludovic Courtès
@ 2017-09-12 18:49   ` Christopher Baines
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Baines @ 2017-09-12 18:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]

On Mon, 11 Sep 2017 14:12:34 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> 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.

Awesome, thanks Ludo.

Your explaination makes lots of sense, and the approach you suggested
worked perfectly :)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-12 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11  6:58 Using the Guile json module in a gexp Christopher Baines
2017-09-11 12:12 ` Ludovic Courtès
2017-09-12 18:49   ` Christopher Baines

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.