Subject: bug#57121: clojure-build-system fails to compile -- backtrace from language/tree-il/peval.scm

From: Maxim Cournoyer <[email-masked]>
Date: Sat, 27 Aug 2022 11:53:53 -0400

Hi Maxime,

Maxime Devos <[email-masked]> writes:

> On 23-08-2022 06:06, Maxim Cournoyer wrote:
>> Hi Maxime,
>>
>> Maxime Devos<[email-masked]>  writes:
>>
>>> On 22-08-2022 17:32, Maxim Cournoyer wrote:
>>>>> These patches are for Guix' build system.  I don't see anything that
>>>>> could be done on the Guile side, except for eventually migrating some
>>>>> dependency tracking stuff over to Guile
>>>> If a module imports a different module, and that module changes, even if
>>>> it's macro, Guile should not blindly reuse the stale .go like it
>>>> currently does.  It should complain and evaluate from source instead.
>>>>
>>>> That would cover the base and avoid breakage.  After, if it known how to
>>>> do that, yes, it seems it'd be useful to have something similar to 'gcc
>>>> -M' to provide the needed intelligence to the build system.
>>>>
>>>> Does that make sense?
>>> Sounds reasonable, though we could go for something less general in
>>> Guix first.
>> I'd rather avoiding adding more complexity in Guix if it can be fixed
>> upstream; where it'd benefit everyone most.
>
> It cannot be solved upstream, this is not a pure Guile matter but also
> a build system matter. Even if this the 'if that module changes, it
> ... should evaluate from source' was implemented, the build system
> still needs to know to compile the module.

OK.  I'd welcome fixing as much of it as possible in Guile, then adding
the Guix-specific bits on top of it.  We already carry a bit too many
things in Guix that could be in Guile proper, in my opinion.

> More concretely, build-aux/compile-all.scm uses the following to
> determine what needs to be recompiled:
>
>> (define (file-needs-compilation? file)
>>   (let ((go (scm->go file)))
>>     (or (not (file-exists? go))
>>         (file-mtime<? go file))))
> --- just interpreting imported modules that have changed doesn't cause
>     the importing module to be recompiled.
>

[...]

OK, I see that since we already implement such mechanism in Guix, it's
on our shoulders to fix it there.  I'm changing my mind but with what I
said above (as much of the fix to go in Guile, the rest on top in Guix).

Thank you,

Maxim