unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Re: Fixing non-reproducibility in some guile packages
       [not found]       ` <87h93y4nr3.fsf@gmail.com>
@ 2017-02-13  7:13         ` Andy Wingo
  2017-02-13 16:25           ` Christopher Allan Webber
  2017-02-13 17:39           ` Maxim Cournoyer
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Wingo @ 2017-02-13  7:13 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: guix-devel, guile-devel

Hi :)

[+guile-devel]

On Mon 13 Feb 2017 07:18, Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

>>>      ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
>>>      ;;;       or pass the --no-auto-compile argument to disable.
>>>      ;;; compiling /gnu/store/d3gli8g5bv6yhd3qwk5rfzqpsfvnj4lv-guile-next-2.1.5/bin/guild
>
> I've notice this same problem recently while looking at the build-log of
> our GnuCash package.. It seems to be the problem is caused by the Guile
> wanting to auto-compile the guild script, and not being able to as it
> wants to store the compiled version somewhere under $HOME.
>
> Could a generally applicable solution be to distribute a pre-compiled
> guild.go in the store, so that it would use that and never attempt to
> 'auto-compile' it?  This would effectively fix this problem for good
> without having to create workaround such as using environment variables
> or setting HOME to a temp dir.

The compiled .go files that get installed are only for files found in
the Guile load path.  So like when you load (foo bar), it will look for
foo/bar.go in the %load-compiled-path (and foo/bar.scm in the
%load-path).  This lets you compile foo/bar.scm in your build directory
and have the resulting foo/bar.go in the builddir directly usable from
the build-time %load-path / %load-compiled-path, and to install you just
copy into the final %load-path / %load-compiled-path and that works too.

For scripts that are loaded by absolute file name (guild is a prominent
example) that don't live in the %load-path, this technique isn't
directly applicable.  The existing %load-compiled-path is effectively a
function from name-suffix (like "foo/bar.scm") to absolute path of
compiled .go file.  We would need an additional mechanism to be a
function from absolute source file name to absolute path of .go file.
Perhaps that's doable with an additional path.  Perhaps the fallback
compilation path (~/.cache/guile/...) could be generalized to include
something in $prefix also so that packages can install compiled files.
Incidentally probably we should SHA256 the path to prevent so much
directory traversal...

In some future (is it near or far?), the source -> compiled function
needs additional inputs: checksums or timestamps of "build inputs" or
so, so that when for-syntax definitions (like macros) change, users of
those definitions will recompile.  That is a harder problem though.

Andy



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

* Re: Fixing non-reproducibility in some guile packages
  2017-02-13  7:13         ` Fixing non-reproducibility in some guile packages Andy Wingo
@ 2017-02-13 16:25           ` Christopher Allan Webber
  2017-02-13 17:39           ` Maxim Cournoyer
  1 sibling, 0 replies; 3+ messages in thread
From: Christopher Allan Webber @ 2017-02-13 16:25 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel, guile-devel, Maxim Cournoyer

Andy Wingo writes:

> In some future (is it near or far?), the source -> compiled function
> needs additional inputs: checksums or timestamps of "build inputs" or
> so, so that when for-syntax definitions (like macros) change, users of
> those definitions will recompile.  That is a harder problem though.

Ah yeah, I've been bit by this before.  Though, I imagine we'd run into
a problem where we'd never know how to "garbage collect" anything in
~/.cache/guile/ .  "Maybe not a problem", except if you're hacking some files
constantly... :)

Maybe every guile hacker needs to get in the habit of
`rm -rf ~/.cache/guile/' though? :)



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

* Re: Fixing non-reproducibility in some guile packages
  2017-02-13  7:13         ` Fixing non-reproducibility in some guile packages Andy Wingo
  2017-02-13 16:25           ` Christopher Allan Webber
@ 2017-02-13 17:39           ` Maxim Cournoyer
  1 sibling, 0 replies; 3+ messages in thread
From: Maxim Cournoyer @ 2017-02-13 17:39 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel, guile-devel


[-- Attachment #1.1: Type: text/plain, Size: 2668 bytes --]

Hi Andy, and thank you for your detailed answer!

Andy Wingo <wingo@igalia.com> writes:

> Hi :)
>
> [+guile-devel]
>
> On Mon 13 Feb 2017 07:18, Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>>>>      ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
>>>>      ;;;       or pass the --no-auto-compile argument to disable.
>>>>      ;;; compiling /gnu/store/d3gli8g5bv6yhd3qwk5rfzqpsfvnj4lv-guile-next-2.1.5/bin/guild
>>
>> I've notice this same problem recently while looking at the build-log of
>> our GnuCash package.. It seems to be the problem is caused by the Guile
>> wanting to auto-compile the guild script, and not being able to as it
>> wants to store the compiled version somewhere under $HOME.
>>
>> Could a generally applicable solution be to distribute a pre-compiled
>> guild.go in the store, so that it would use that and never attempt to
>> 'auto-compile' it?  This would effectively fix this problem for good
>> without having to create workaround such as using environment variables
>> or setting HOME to a temp dir.
>
> The compiled .go files that get installed are only for files found in
> the Guile load path.  So like when you load (foo bar), it will look for
> foo/bar.go in the %load-compiled-path (and foo/bar.scm in the
> %load-path).  This lets you compile foo/bar.scm in your build directory
> and have the resulting foo/bar.go in the builddir directly usable from
> the build-time %load-path / %load-compiled-path, and to install you just
> copy into the final %load-path / %load-compiled-path and that works too.
>
> For scripts that are loaded by absolute file name (guild is a prominent
> example) that don't live in the %load-path, this technique isn't
> directly applicable.  The existing %load-compiled-path is effectively a
> function from name-suffix (like "foo/bar.scm") to absolute path of
> compiled .go file.

OK, I see how %load-path and %load-compiled-path currently fail to be
useful in the case of loading a guile script from its absolute
path. Thanks for explaining. 

> function from absolute source file name to absolute path of .go file.
> Perhaps that's doable with an additional path.  Perhaps the fallback
> compilation path (~/.cache/guile/...) could be generalized to include
> something in $prefix also so that packages can install compiled files.

This seem like it would be the simplest solution in the short term, but
maybe not the most elegant. The fallback compilation path seems to refer
to the source file by their exact location though, so it would mean that
if someone was to change the location of the store it would break:


[-- Attachment #1.2: Type: text/plain, Size: 334 bytes --]

guild
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /gnu/store/jz5pb07j8s9vv07f27p52mmsiap3cwps-profile/bin/guild
;;; compiled
/home/maxim/.cache/guile/ccache/2.0-LE-8-2.0/gnu/store/060piiiz4nmb51jc3wk01bgikajrnfjd-guile-2.0.13/bin/guild.go

[-- Attachment #1.3: Type: text/plain, Size: 429 bytes --]


> Incidentally probably we should SHA256 the path to prevent so much
> directory traversal...
>
> In some future (is it near or far?), the source -> compiled function
> needs additional inputs: checksums or timestamps of "build inputs" or
> so, so that when for-syntax definitions (like macros) change, users of
> those definitions will recompile.  That is a harder problem though.
>

Interesting problem!

Thanks again,

Maxim

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2017-02-13 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87fujly0pu.fsf@dustycloud.org>
     [not found] ` <87bmu8y7sx.fsf@dustycloud.org>
     [not found]   ` <87tw80pgpl.fsf@gnu.org>
     [not found]     ` <87efz35ncm.fsf@dustycloud.org>
     [not found]       ` <87h93y4nr3.fsf@gmail.com>
2017-02-13  7:13         ` Fixing non-reproducibility in some guile packages Andy Wingo
2017-02-13 16:25           ` Christopher Allan Webber
2017-02-13 17:39           ` Maxim Cournoyer

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