From: Steve George <steve@futurile.net>
To: Maxime Devos <maximedevos@telenet.be>
Cc: "guix-devel@gnu.org" <guix-devel@gnu.org>,
r0man <roman@burningswell.com>,
Reilly Siegel <mail@reilysiegel.com>
Subject: Re: Proposal to turn off AOT in clojure-build-system
Date: Fri, 23 Feb 2024 16:49:04 +0000 [thread overview]
Message-ID: <o7frantqqq7cwiohq7uwayfh2agiyelivvxado4a3nb5qmlmxp@gkkwh4zfkzus> (raw)
In-Reply-To: <20240222155741.qExg2B0021q4WC401Exg6J@andre.telenet-ops.be>
Hi,
I don't think I'm making any progress convincing you, and I'm not enjoying the interaction so I'm going to take a few days off from this thread.
I've tried to ask the Clojure community for a definitive expression of what they think Linux distributions should do with byte-compiled libraries. We'll see if there's a response, this is a public forum so feel free to chime in and express clearly your perpective:
https://clojureverse.org/t/should-linux-distributions-ship-clojure-byte-compiled-aot-or-not/10595/1
Thanks,
Steve / Futurile
On 22 Feb, Maxime Devos wrote:
> >> [...]
> >> > 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]
> >>
> >> This reasoning does not follow – yes, it is tied to the Clojure version, so what? Guix automatically rebuilds dependents when the dependency (in this case, the Clojure compiler) changes.
> (...)
>
> >I think this preceding sentence is the heart of different assumptions between us.
>
> >The Clojure packages we haave are for developers writing applications (libraries and tools). The ecosystem has very few end-user applications [0]. As a Clojure developer I can use the Clojure tools from Guix, and a few libraries. We (and all the other distributions) have a miniscule portion of the Clojure/Java library universe [1]. This leads to the following usage scenarios:
>
> >1. A developer installs Clojure from Guix, and uses libraries from outside Guix.
> They can install the JVM/Clojure and some common tools (like clj-tools-cli). They will use libraries from elsewhere, including their own. AOT compilation is a problem because of the issue of mixed AOT and non-AOT.
>
> >2. A developer installs a Clojure from outside Guix, uses libraries from inside Guix
> This will cause problems because the Guix Clojure libraries will have been AOT'd by a different version of the compiler. It's also fairly common to install/use parallel versions of Clojure/jvm due to different deployment needs, this is likely to cause difficult to find bugs.
>
> My answer to (1) and (2) is:
>
> (a) About “install Clojure from outside Guix + use libraries inside Guix”:
>
> If these libraries are AOT:
>
> Don’t do that, then. If you mix-and-match binaries (in this case, .class files) different distributions, you are free to do so, but when (not if, when) things break, you get to keep the pieces.
>
> If these libraries are just the .clj files (not AOT) (which as I understand it is the standard situation): doesn’t seem a problem to me (see point (b)).
>
> Adding source from other places is one thing (probably ok), adding binaries is another (probably not ok, especially if unstable ABIs (see Clojure compiler) and mismatched versions (see hypotheses of 2.) are involved.
>
> (b) What is this “the issue of mixed AOT and non-AOT”? Do you have a source on this? Besides Clojure supposedly, I haven’t ever heard of such problems for any language – for example, there is no such issue with Guile and AFAIK not for Python. I haven’t heard of any such issues for the Common Lisp implementations either (though I haven’t checked), so this doesn’t seem like a “Clojure doesn’t do hygienic macros” issue.
>
> (c) Guix isn’t forcing anyone to use AOT’d libraries. If people really want to assist in murdering the climate (or its a situation where total cost of non-AOT is lower than AOT), they can unfortunately (*) simply do so applying a recursive transformation that adds #:aot? #false flags everywhere or whatever the exact argument is (**).
>
> Given that this transformation has some legitimate use cases, this transformation could even be a pre-canned procedure + transformation included in Guix itself
>
> (*) ‘unfortunately’ only applies to the first case. For the case in parentheses, replace by ‘fortunately’.
> (**) IIRC is wasn’t #:aot? but some other name, but that’s not really the point here.
>
> (d) If a deployment need multiple versions of Clojure, then just fix your deployment to make everything work with the latest version of Clojure. Or, if you for some reason don’t do that, just use a (recursive) transformation to change the version of the Clojure compiler used to match the Clojure that will be used in the particular deployment.
>
> (e) You can simply add missing packages to Guix as the need arises.
>
> >I can see the sense of compiling to byte code if it's an end-user application. In that case we'd want to make the start-up as fast as possible. Your comments seem to have this use-case in mind.
>
> >But, today there aren't any such end-user Clojure applications in Guix.
>
> That’s a shame. Hopefully that will change some day.
> Also, this is false, “clojure-tools” exists – developers are people too (I don’t care about the “_end_-user” distinction – surely developers want fast start-up as well).
>
> Also, I _don’t_ have that use case in mind – I have efficiency in general in mind, efficiency of the start-up is only a part of that.
>
> The point is: most likely you will want the application to have AOT code, and that library has dependencies. Furthermore, likely many of these dependencies are dependencies of other applications as well.
>
> Instead of redoing the compilation of N shared dependencies for each M applications (total work: ~N*M), by not participating in these Clojure conventions, the total work of compiling dependencies can be reduced to ~N).
>
> Let’s avoid joining the madness that is Go’s build system and Cargo(*).
>
> (*) Rust is fine for compilation, it’s cargo that is the problem (at least, Cargo as used by Guix) – antioxidant (https://notabug.org/maximed/cargoless-rust-experiments) avoids the sheer inefficiency of Cargo.
>
> >> >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.
> >>
> >> Unlike, say, Maven, this situation simply does not happen in Guix, because we don’t just download binaries and call it a day (except for some bootstrapping stuff, but that’s not relevant for Clojure AOT), because we have functioning recompilation of dependents, because of shebang patching, because binaries that are to be invoked should not rely on the ambient CLASSPATH / LD_LIBRARY_PATH / etc. and, if, the underlying binaries do rely on that, they are wrapped (see wrap-program) to set them (or, at least, they should be, you might find some bugs in this department if you go looking).
> >>
> >> Even if they aren’t wrapped, then in that case the dependencies are propagated-inputs, and you can only have a single version of a propagated package in the same environment (barring stacking environment shenanigans, but then you are looking for it and/or you can just report a bug about how the binaries should be wrapped/classpath should be patched in/...).
> >
>
> >In this paragraph you're assumption is that a Guix user is only using libraries from within Guix. Hopefully, I've shown why this assumption is unlikely above.
>
> You haven’t. You have shown that other situations exist, not that this situation is unlikely. To demonstrate likelihood / unlikelyhood, you need some statistics (or a very thorough argument on why people wouldn’t just make a package for missing dependencies – it’s very simple, especially if you aren’t sending them for inclusion.)
>
> >You also mentioned Debian, and @e.hashiman [2] said that Clojure libraries are not AOT'd on Debian, while applications are. From what I can find there are 130 packages in Debian with the word Clojure in them [3]. I looked at a selection and it seems true that Debian does not AOT libraries (and I can't find any Clojure 'apps'). For completeness I also checked what Clojars, the main distribution archive for Clojure developers, does:
> > [...]
>
> OK ... and? Other people doing things differently doesn’t mean those different approaches are better. If Debian mentions somewhere the reason _why_ it doesn’t AOT libraries, that reason can be investigated and perhaps carried over to Guix, but it’s the ‘why’ that’s important, not the ‘it doesn’t’.
>
> > Does this help clarify why I'm asking to change the default?
>
> Yes. It appears you are unfamiliar with the “transformations” functionality of Guix, which allows for easy rewriting of packages to whatever Clojure version you want, eliminating compatibility concerns or even turning off AOT completely.
>
> (This requires the relevant versions of Clojure to be packaged in Guix, but that shouldn’t be too much of a problem.)
>
> It also appears you are unfamiliar with Guix importers, which easily make package definitions (somewhat low quality w.r.t. descriptions, with lack of verification of freeness, etc., but usually otherwise fully functional). I don’t know if an importer for Clojure exists but it shouldn’t be too difficult I think.
>
> Best regards,
> Maxime Devos.
next prev parent reply other threads:[~2024-02-23 17:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 11:46 Proposal to turn off AOT in clojure-build-system Steve George
2024-02-19 14:44 ` Maxime Devos
2024-02-21 11:29 ` Steve George
2024-02-22 14:57 ` Maxime Devos
2024-02-22 15:33 ` Andreas Enge
2024-02-22 15:47 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-02-22 17:44 ` Maxime Devos
2024-02-23 2:13 ` Maxim Cournoyer
2024-02-22 17:12 ` Maxime Devos
2024-02-23 12:41 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2024-02-23 16:49 ` Steve George [this message]
2024-02-19 18:13 ` Ryan Sundberg
2024-02-19 21:38 ` Carlo Zancanaro
2024-02-24 3:39 ` 宋文武
2024-03-09 22:27 ` Ian Eure
2024-03-12 12:12 ` Jean-Pierre De Jesus Diaz
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=o7frantqqq7cwiohq7uwayfh2agiyelivvxado4a3nb5qmlmxp@gkkwh4zfkzus \
--to=steve@futurile.net \
--cc=guix-devel@gnu.org \
--cc=mail@reilysiegel.com \
--cc=maximedevos@telenet.be \
--cc=roman@burningswell.com \
/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.
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.