guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposal to turn off AOT in clojure-build-system


From: Steve George
Subject: Proposal to turn off AOT in clojure-build-system
Date: Mon, 19 Feb 2024 11:46:53 +0000

Hi,

Guix's clojure-build-system turns on AOT compilation by default. I would like 
to advocate that 'as a distributor' we should *not* ship Clojure code AOT'd, so 
we should change the default.

This has been discussed previously. In #56604 r0man noted that AOT compilation 
should not be on by default [0], Reilly makes the same point in #53765 [1].

Maxime makes the point that where a compiler is available it should be used [2] 
and that if it doesn't work it's a bug:

  "if a Clojure library misbehaves when AOT-compiled, without additional 
context, that seems like a bug in the Clojure library to me (or the 
AOT-compilation code).

The perspective in the Clojure community is quite different from Guix's on a 
number of fronts. There's not much discussion about offline builds, 
reproducibility or code coming from Distributions. The internalised perspective 
is that you use the build tools to download libraries directly from Clojars (a 
Maven repo) and developers create a final uberjar for production usage 
Consequently, there is no specific statement saying 'Distributors should not 
AOT libraries' that I can point to. But, I would like to draw attention to this 
thread on Clojureverse as the best source I could find:

Alex Miller is the main community manager for Clojure, and is a maintainer of 
the core libraries, so his perspective is key. He notes that, AOT code is tied 
to *specific versions of Clojure*:

  "AOT'ed code is that it is inherently the product of a particular version of 
tthe Clojure compiler ... I would recommend NOT AOT compiling libraries" [4]

In the same thread thheller, who is the maintainer of the most popular 
ClojureScript tooling,  notes you cannot mix AOT and non-AOT libraries [5]:

    "you cannot just ship your library AOT compiles as it would also contain 
clojure.core. Clojure AOT current ... can not load clj files from .class files. 
So AOT produces the class files and will fail if one of the dependent classes 
is missing although the .clj file is present"

I believe this means that with AOT code on, any user who installs a different 
version of Clojure from the one that we used to AOT the libraries *may* have 
problems. And, that we can't have trees where some part is AOT'd but a 
dependency is not. Finally, there is no expectation in the Clojure community 
that this is a bug, consequently it will not be fixed. Therefore, we should 
change to default to AOT off.

What do people think, does this make sense?

Thanks,

Steve / Futurile

[0] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56604#5
[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=53765#290
[2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=53765#293
[4] https://clojureverse.org/t/deploying-aot-compiled-libraries/2545/6
[5] https://clojureverse.org/t/deploying-aot-compiled-libraries/2545/3
[5] https://gist.github.com/hiredman/c5710ad9247c6da12a99ff6c26dd442e



reply via email to

[Prev in Thread] Current Thread [Next in Thread]