Subject: bug#49270: 28.0.50: native-comp: macOS self-contained .app does not use bundled *.eln files

From: Jim Myhrberg <[email-masked]>
Date: Tue, 29 Jun 2021 14:07:08 +0100

On Tue, Jun 29, 2021 at 1:25 PM Eli Zaretskii <[email-masked]> wrote:
>
> > From: Jim Myhrberg <[email-masked]>
> > Date: Tue, 29 Jun 2021 12:51:48 +0100
> >
> > When performing a self-contained Emacs.app build, *.eln files for
> > Emacs' built-in lisp files stored within the Emacs.app bundle are not
> > used.
>
> Thanks, but how do you see that?

For better or worse, in a rather unsophisticated way; by launching Emacs.app and
seeing the async native-comp kick off for all of Emacs' built-in lisp files. And
by doing some additional experiments with *.eln files just now.

The Emacs.app bundle I built earlier today includes
"bytecomp-12882072-3f2b96ca.eln" in
"Emacs.app/Contents/MacOS/lib/emacs/28.0.50/native-lisp", but when launching
Emacs.app it performs async native-comp on bytecomp.el, and produced
"bytecomp-a3d51747-3f2b96ca.eln" in my user eln cache folder. If I just relaunch
Emacs again it does not re-compile bytecomp.el.

If I move the newly created "bytecomp-a3d51747-3f2b96ca.eln" from my user eln
cache folder into the Emacs.app bundle next to the original bytecomp-*.eln, and
launch Emacs.app, it also does not re-compile bytecomp.el.

However, if I then move Emacs.app itself (from /Users/jimeh/Downloads to
/Users/jimeh/Desktop in this case), it will re-compile bytecomp.el again on
launch, producing "bytecomp-30860bee-3f2b96ca.eln" in my user eln cache folder.

At the end I have three separate bytecomp-*.eln files:

- "bytecomp-12882072-3f2b96ca.eln" - produced at Emacs build time and bundled
  into the app
- "bytecomp-a3d51747-3f2b96ca.eln" - produced via async native-comp at launch of
  Emacs.app while it was located in "/Users/jimeh/Downloads/", with absolute
  path to bytecomp.el.gz being
  "/Users/jimeh/Downloads/Emacs.app/Contents/Resources/lisp/emacs-lisp/bytecomp.el.gz"
- "bytecomp-30860bee-3f2b96ca.eln" - produced via async native-comp at launch of
  Emacs.app while it was located in "/Users/jimeh/Desktop/", with absolute path
  to bytecomp.el.gz being
  "/Users/jimeh/Desktop/Emacs.app/Contents/Resources/lisp/emacs-lisp/bytecomp.el.gz"

And this is why I believe the first checksum within *.eln file names is based on
the absolute path even when the source .el/.el.gz files are located within a
.app bundle.

Also, I forgot mention earlier, but the previous bug for this issue from last
year is bug#43532, potentially that might give some additional context.