unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Cc: Andrea Corallo <akrl@sdf.org>, Lars Ingebrigtsen <larsi@gnus.org>,
	 Stefan Monnier <monnier@iro.umontreal.ca>,
	Rob Browning <rlb@defaultvalue.org>
Subject: Re: Finalizing 'inhibit-automatic-native-compilation'
Date: Sat, 04 Feb 2023 18:48:34 +0100	[thread overview]
Message-ID: <440f4cbd46a2db3c9963bc32aba9abe6cbe108ea.camel@gmail.com> (raw)
In-Reply-To: <837cx8cey0.fsf@gnu.org>

Hi Eli,

Am Freitag, dem 27.01.2023 um 14:57 +0200 schrieb Eli Zaretskii:
> The variable 'inhibit-automatic-native-compilation' was introduced in
> last October, as result of various discussions on this list regarding
> the need to disable async native-compilation in some situations.
> Since its introduction was met with some opposition, in particular
> from Andrea, the final decision about whether this variable should
> stay in Emacs was deferred, with the purpose of collecting more data
> points and user experience.
> 
> With the pretest of Emacs 29 just around the corner, I think now is
> the time to make that final decision.  With that in mind, I will
> first summarize the changes which this variable introduced into
> Emacs, and then ask for opinions regarding some of its aspects.
Since I am on the Guix team for Emacs packaging, I'll try to lay out
some concerns both from the perspective of a user and a downstream
packager.  I hope I'm not too late to the party.

> This variable was introduced (under the name
> 'inhibit-native-compilation') in commit 5fec9182db.  In that commit:
> 
>   . comp-trampoline-compile was changed to avoid writing the
>     trampolines to the eln-cache if this variable is non-nil
> (instead,
>     it writes the trampolines to a temporary-file directory, and
>     attempts to delete them after that, which on Posix platforms will
>     cause their deletion when Emacs which produced them exits, and on
>     Windows currently fails).
>   . In normal-top-level, we set this variable if the environment
>     variable EMACS_INHIBIT_AUTOMATIC_NATIVE_COMPILATION is set.
>   . In several places this variable either replaces
>     native-comp-deferred-compilation or has the same effect as the
>     latter (modulo the opposite meaning of nil/t value), therefore
>     disabling async compilation of *.el files that Emacs loads for
>     which there are no corresponding *.eln files.
> 
> Here are the questions I think we want to be answered to finalize the
> implementation and effects of 'inhibit-automatic-native-compilation':
> 
>   . Do people actually use 'inhibit-automatic-native-compilation' or
>     the corresponding environment variable?  If so, for what reasons,
>     and why tweaking 'native-comp-eln-load-path' to direct the *.eln
>     files to some other place, including the temporary-file
> directory,
>     was not enough?
On Guix, I want my Emacs packages to either (1) already have been
natively compiled when using `guix install some-emacs-package' or (2)
to not natively compile anything and clutter my user-emacs-directory. 
Now the concern about clutter is somewhat secondary to Emacs spending
time that some other Emacs could have spent on CI.  (We don't do native
compilation on CI *yet*, but imho it would be worth doing for some
packages)

>   . What do we want to do about compiling trampolines when
>     native-compilation is disabled?
In my opinion, there should be a way to generate these trampolines
ahead of time in a known location (e.g. $package-trampolines.so) for
the emacs package $package.  If no such trampoline is found and native-
compilation is disabled, no compilation should take place.

>     Currently, 'inhibit-automatic-native-compilation' doesn't really
>     disable compilation of trampolines, it just causes them to be
>     written to a temporary location, and hopefully deleted when the
>     session ends.  This means that, for example, if the user has a
>     broken installation of GCC and Binutils, loading Lisp code that
>     uses advices will signal errors when Emacs compiles the
>     trampolines (because the compilation fails).
>     The alternative is to disable compilation of trampolines, but
> that
>     has a downside that advices for primitives will not have effect.
>     It is not clear to me which alternative is better, as they both
>     have failure modes.  Note that the build process was augmented so
>     you can say, after building Emacs as usual
> 
>        make trampolines
> 
>     and have all the trampolines for the built-in functions
>     (a.k.a. "primitives") compiled and written to the build tree,
> from
>     where they will be installed by "make install", thus minimizing
>     potential problems with the need to build trampolines when
> running
>     the installed Emacs.
> 
>     If we leave the current build-trampolines-then-delete-them
>     machinery intact, is it a problem to have those trampolines not
>     deleted on MS-Windows?  They will then be left in the temporary
>     directory, and are supposed to be removed by system cleanup
>     processes, or maybe remain there forever.  Or do we have to add a
>     mechanism for deleting them at exit?
In my opinion, the failure mode of not being able to advise native code
is an acceptable one.  If possible, I'd like to extend the "make
trampolines" approach into one that can also be applied to packages
installed via package.el/straight/...

>   . Do we want to keep the EMACS_INHIBIT_AUTOMATIC_NATIVE_COMPILATION
>     environment variable?
> 
>     I dislike having environment variables that alter Emacs behavior,
>     because environment variables are inherited by sub-processes.  So
>     having this variable set runs the risk of affecting all the
>     sub-processes, something that could be unexpected and is not easy
>     to prevent.  We had similar problems with EMACSLOADPATH, for
>     example, which is especially painful when building another
> version
>     of Emacs from a shell buffer inside Emacs.  This causes some
>     hard-to-debug problems.
>     So if this environment variable is largely unused, maybe we
> should
>     remove it, even if we keep 'inhibit-automatic-native-
> compilation'.
I don't think a variable is needed necessarily.  What is needed is a
method of enabling it reliably on the command line (i.e. a switch like
--no-native-compilation would work, but so would --eval '(setq inhibit-
automatic-native-compilation t)'), and reliably as a user editing just
Emacs configuration files (in particular, early-init.el seems like the
place I would naturally place it in).


Cheers



  parent reply	other threads:[~2023-02-04 17:48 UTC|newest]

Thread overview: 146+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 12:57 Finalizing 'inhibit-automatic-native-compilation' Eli Zaretskii
2023-01-27 14:19 ` Andrea Corallo
2023-01-27 23:11 ` Stephen Leake
2023-01-27 23:58   ` Stefan Monnier
2023-01-28  0:32     ` Stephen Leake
2023-01-28  8:31       ` Eli Zaretskii
2023-01-28  8:08   ` Eli Zaretskii
2023-01-29 21:42     ` Stephen Leake
2023-01-27 23:57 ` Stefan Monnier
2023-01-28  9:17   ` Eli Zaretskii
2023-01-28 17:00     ` Stefan Monnier
2023-01-28 17:09       ` Eli Zaretskii
2023-01-28 17:42         ` Stefan Monnier
2023-01-28 17:54           ` Eli Zaretskii
2023-01-28 18:00             ` Stefan Monnier
2023-01-28 18:09               ` Eli Zaretskii
2023-01-28 21:41                 ` Andy Moreton
2023-01-29  6:46                   ` Eli Zaretskii
2023-01-29 11:46                     ` Andy Moreton
2023-01-28 22:24                 ` Stefan Monnier
2023-01-29  6:25                   ` Eli Zaretskii
2023-01-29 14:58                     ` Stefan Monnier
2023-01-29 15:30                       ` Eli Zaretskii
2023-01-30  2:30                         ` Stefan Monnier
2023-01-30 12:47                           ` Eli Zaretskii
2023-01-30 14:57                             ` Stefan Monnier
2023-01-30 17:07                               ` Eli Zaretskii
2023-01-30 17:18                                 ` Stefan Monnier
2023-01-31  4:19                               ` Richard Stallman
2023-01-31 14:26                                 ` Stefan Monnier
2023-02-01  5:04                                   ` Richard Stallman
2023-02-04 19:55                                     ` Lynn Winebarger
2023-02-04 20:08                                       ` Eli Zaretskii
2023-02-04 22:05                                         ` Lynn Winebarger
2023-02-05  7:40                                           ` Eli Zaretskii
2023-02-05 16:22                                             ` Lynn Winebarger
2023-02-06 10:15                                             ` Andrea Corallo
2023-02-06 10:25                                               ` Andrea Corallo
2023-02-06 13:05                                               ` Eli Zaretskii
2023-02-06 13:37                                                 ` Lynn Winebarger
2023-02-06 14:07                                                   ` Eli Zaretskii
2023-02-06 14:29                                                     ` Lynn Winebarger
2023-02-06 15:28                                                       ` Eli Zaretskii
2023-02-07  3:57                                                         ` Lynn Winebarger
2023-02-06 15:26                                               ` Lynn Winebarger
2023-02-02  5:18                           ` Sean Whitton
2023-02-02  7:55                             ` Eli Zaretskii
2023-02-02 16:17                               ` Sean Whitton
2023-02-06 10:57                                 ` Aymeric Agon-Rambosson
2023-02-06 14:29                                   ` Eli Zaretskii
2023-02-07  3:39                                     ` Aymeric Agon-Rambosson
2023-02-07 12:49                                       ` Eli Zaretskii
2023-02-09  8:40                                         ` Aymeric Agon-Rambosson
2023-02-09 10:11                                           ` Eli Zaretskii
2023-02-09 21:07                                             ` Sean Whitton
2023-02-10  8:13                                               ` Eli Zaretskii
2023-02-10  8:37                                             ` Aymeric Agon-Rambosson
2023-02-10 16:53                                               ` Andrea Corallo
2023-02-10 17:34                                                 ` Aymeric Agon-Rambosson
2023-02-11  8:11                                                   ` Andrea Corallo
2023-02-11 10:06                                                     ` Aymeric Agon-Rambosson
2023-02-11 10:44                                                       ` Eli Zaretskii
2023-02-12 16:47                                                         ` Aymeric Agon-Rambosson
2023-02-12 16:55                                                           ` Eli Zaretskii
2023-02-12 19:58                                                             ` Aymeric Agon-Rambosson
2023-02-12 20:09                                                               ` Eli Zaretskii
2023-02-14 10:36                                                                 ` Aymeric Agon-Rambosson
2023-02-14 13:51                                                                   ` Eli Zaretskii
2023-02-15 22:39                                                                     ` Aymeric Agon-Rambosson
2023-02-16  8:04                                                                       ` Eli Zaretskii
2023-02-17  8:15                                                                         ` Eli Zaretskii
2023-02-17 10:16                                                                           ` Andrea Corallo
2023-02-17 14:17                                                                             ` Eli Zaretskii
2023-02-18 21:48                                                                               ` Andrea Corallo
2023-02-19  9:21                                                                                 ` Eli Zaretskii
2023-02-20  9:14                                                                                   ` Andrea Corallo
2023-02-20 12:02                                                                                     ` Eli Zaretskii
2023-02-09 21:05                                       ` Sean Whitton
2023-02-10  8:08                                         ` Eli Zaretskii
2023-02-10 22:13                                           ` Sean Whitton
2023-02-11  9:16                                             ` Eli Zaretskii
2023-02-13 22:57                                               ` Sean Whitton
2023-02-14  5:17                                                 ` tomas
2023-02-14 13:21                                                   ` Eli Zaretskii
2023-02-14 11:29                                                 ` Andrea Corallo
2023-02-14 17:11                                                   ` Sean Whitton
2023-02-16 18:10                                                   ` Sean Whitton
2023-02-17  9:00                                                     ` Andrea Corallo
2023-02-17 16:42                                                       ` Sean Whitton
2023-02-17 19:18                                                         ` Eli Zaretskii
2023-02-17 21:13                                                         ` Bug#1021842: " Tatsuya Kinoshita
2023-02-18 21:56                                                           ` Andrea Corallo
2023-02-19  4:22                                                             ` Stefan Monnier
2023-02-20  9:03                                                               ` Andrea Corallo
2023-02-20 12:01                                                                 ` Eli Zaretskii
2023-02-20 15:42                                                                   ` Andrea Corallo
2023-02-20 16:02                                                                     ` Stefan Monnier
2023-02-20 20:22                                                                       ` Andrea Corallo
2023-02-20 16:57                                                                     ` Eli Zaretskii
2023-02-20 20:29                                                                       ` Andrea Corallo
2023-02-20 12:48                                                                 ` Stefan Monnier
2023-02-20 16:07                                                                   ` Andrea Corallo
2023-02-20 17:24                                                                     ` tomas
2023-02-07 13:56                                   ` Andrea Corallo
2023-02-07 15:03                                     ` Stefan Monnier
2023-02-07 15:27                                       ` Andrea Corallo
2023-02-09  7:26                                     ` Aymeric Agon-Rambosson
2023-02-09  7:52                                       ` Eli Zaretskii
2023-02-10  8:04                                         ` Aymeric Agon-Rambosson
2023-02-10  8:46                                           ` Eli Zaretskii
2023-02-10 17:02                                             ` Andrea Corallo
2023-02-02  5:40 ` Sean Whitton
2023-02-02  8:02   ` Eli Zaretskii
2023-02-02  8:41     ` tomas
2023-02-02  9:18       ` Eli Zaretskii
2023-02-02 16:28     ` Sean Whitton
2023-02-02 17:21       ` Eli Zaretskii
2023-02-09 21:12         ` Sean Whitton
2023-02-04 17:48 ` Liliana Marie Prikler [this message]
2023-02-04 18:18   ` Eli Zaretskii
2023-02-06 10:21     ` Andrea Corallo
2023-02-13 12:05 ` Andrea Corallo
2023-02-13 13:19   ` Eli Zaretskii
2023-02-13 15:21     ` Andrea Corallo
2023-02-13 15:37       ` Eli Zaretskii
2023-02-13 16:15         ` Andrea Corallo
2023-02-13 19:17   ` Stefan Monnier
2023-02-13 19:34     ` Andrea Corallo
2023-02-13 20:43       ` Stefan Monnier
2023-02-13 21:53         ` Andrea Corallo
2023-02-13 23:04           ` Stefan Monnier
2023-02-14  8:56             ` Andrea Corallo
2023-02-14 11:32             ` Andrea Corallo
     [not found]               ` <166586215062.368699.18398270685158383578.reportbug@convex>
2023-02-19 14:31                 ` Bug#1021842: " Tatsuya Kinoshita
2023-02-20  9:18                 ` Andrea Corallo
2023-02-20 12:03                   ` Eli Zaretskii
2023-02-20 20:50                 ` Bug#1021842: " Lynn Winebarger
2023-02-20 21:34                   ` Stefan Monnier
2023-02-20 22:17                     ` Lynn Winebarger
2023-02-20 22:02                 ` Bug#1021842: " Tatsuya Kinoshita
2023-02-21 15:40                 ` Andrea Corallo
2023-02-14  3:23       ` Eli Zaretskii
2023-02-14  3:31         ` Stefan Monnier
2023-02-14  8:55           ` Andrea Corallo
2023-02-14 13:11           ` Eli Zaretskii
2023-02-14 15:09             ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=440f4cbd46a2db3c9963bc32aba9abe6cbe108ea.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=akrl@sdf.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rlb@defaultvalue.org \
    /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 public inbox

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

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