Subject: Re: bug#58267: 29.0.50; Native-compiling the same files at every start

From: Eli Zaretskii <[email-masked]>
Date: Tue, 04 Oct 2022 22:45:14 +0300

> From: Holger Schurig <[email-masked]>
> Date: Tue, 4 Oct 2022 21:20:36 +0200
> Cc: [email-masked]
> 
> Thanks for looking into it. native-comp-eln-load-path is:
> 
> ("/home/holger/.emacs.d/eln-cache/" "/usr/local/stow/emacs/lib/emacs/29.0.50/native-lisp/")
> 
> And the first directory is certainly writable:
> 
> holger@holger:~$ ll ~/.emacs.d/eln-cache/
> total 4
> drwxr-xr-x 2 holger holger 4096 Oct  4 21:08 29.0.50-aee1894c/
> holger@holger:~$ ll ~/.emacs.d/eln-cache/29.0.50-aee1894c/
> total 4724
> -rwxr-xr-x 1 holger holger 108536 Oct  3 09:04 cl-extra-d7051cba-954d0113.eln*
> -rwxr-xr-x 1 holger holger  61192 Oct  3 09:04 cl-lib-8b938900-c76f14d9.eln*
> -rwxr-xr-x 1 holger holger 333328 Oct  3 09:05 cl-macs-7ae82f81-7195f6d0.eln*
> -rwxr-xr-x 1 holger holger  61032 Oct  4 21:07 cl-print-79bf9fb1-c759fffb.eln*
> -rwxr-xr-x 1 holger holger 128112 Oct  3 09:04 cl-seq-f464c4e2-41e7a709.eln*
> -rwxr-xr-x 1 holger holger  46168 Oct  3 09:05 derived-381801a7-44101f77.eln*
> -rwxr-xr-x 1 holger holger 314336 Oct  3 09:06 dired-6a3ae2bc-a97b899d.eln*
> -rwxr-xr-x 1 holger holger  39168 Oct  3 09:05 display-line-numbers-1d060f2e-ac11bdb2.eln*
> -rwxr-xr-x 1 holger holger  50896 Oct  3 09:06 emacsbug-2b184f71-463477ae.eln*
> -rwxr-xr-x 1 holger holger 109760 Oct  3 09:05 epa-bdd8ea1c-902eeb9e.eln*
> -rwxr-xr-x 1 holger holger  34696 Oct  3 09:05 epg-config-78240760-6b96d0a3.eln*
> -rwxr-xr-x 1 holger holger 414104 Oct  3 09:05 epg-de089247-f5f7c3c5.eln*
> -rwxr-xr-x 1 holger holger  22304 Oct  3 09:05 gmm-utils-3a9b481d-ca3307d0.eln*
> -rwxr-xr-x 1 holger holger 154784 Oct  3 09:05 gnus-util-b645aa9c-09000edd.eln*
> -rwxr-xr-x 1 holger holger 211592 Oct  3 09:04 gv-e0cf7478-70e05b9c.eln*
> -rwxr-xr-x 1 holger holger 182992 Oct  4 21:07 help-fns-d233c6e8-a099ac59.eln*
> -rwxr-xr-x 1 holger holger  73536 Oct  3 09:04 help-mode-d4dbae3d-942d04d2.eln*
> -rwxr-xr-x 1 holger holger  35328 Oct  3 09:04 icons-eafe82eb-aebf40bc.eln*
> -rwxr-xr-x 1 holger holger  41688 Oct  3 09:05 ietf-drums-23d9ecfe-d43bb971.eln*
> -rwxr-xr-x 1 holger holger  97616 Oct  3 09:06 mail-extr-e04131ae-0d3fbd03.eln*
> -rwxr-xr-x 1 holger holger  19856 Oct  3 09:05 mail-parse-5e7f4583-4dd5f035.eln*
> -rwxr-xr-x 1 holger holger  38032 Oct  3 09:05 mail-utils-ae525238-1df0075a.eln*
> -rwxr-xr-x 1 holger holger  44736 Oct  3 09:05 mailabbrev-287b6d20-0b61dba5.eln*
> -rwxr-xr-x 1 holger holger  75672 Oct  3 09:05 mailcap-a1205653-fa0834cd.eln*
> -rwxr-xr-x 1 holger holger  26520 Oct  3 09:05 mailheader-2dff755b-d62c8c9d.eln*
> -rwxr-xr-x 1 holger holger 571024 Oct  3 09:06 message-4a315c5a-c7ff10aa.eln*
> -rwxr-xr-x 1 holger holger  29928 Oct  3 09:05 mm-bodies-5a92b2dc-09a021c3.eln*
> -rwxr-xr-x 1 holger holger 176576 Oct  3 09:05 mm-decode-4a4c16d8-5bfcef52.eln*
> -rwxr-xr-x 1 holger holger  27776 Oct  3 09:05 mm-encode-4f0ce800-f393314a.eln*
> -rwxr-xr-x 1 holger holger  62432 Oct  3 09:05 mm-util-3a4439f0-1f9a87ba.eln*
> -rwxr-xr-x 1 holger holger 126880 Oct  3 09:05 mml-34028078-bb605e70.eln*
> -rwxr-xr-x 1 holger holger 103496 Oct  3 09:05 mml-sec-827872f6-853bc022.eln*
> -rwxr-xr-x 1 holger holger  19384 Oct  3 09:05 password-cache-187e4eec-58743954.eln*
> -rwxr-xr-x 1 holger holger  43240 Oct  3 09:06 pp-5d47c1cc-a707bff5.eln*
> -rwxr-xr-x 1 holger holger  30168 Oct  3 09:05 puny-eb5a151f-3cb4b46d.eln*
> -rwxr-xr-x 1 holger holger  16360 Oct  3 09:05 rfc2045-713c994b-52b58bf3.eln*
> -rwxr-xr-x 1 holger holger  72400 Oct  3 09:05 rfc2047-b84e264d-9d53d444.eln*
> -rwxr-xr-x 1 holger holger  33248 Oct  3 09:05 rfc2231-e2cbed75-26dda543.eln*
> -rwxr-xr-x 1 holger holger  18032 Oct  3 09:05 rfc6068-5e4d60aa-08220a90.eln*
> -rwxr-xr-x 1 holger holger  28592 Oct  3 09:05 rfc822-a91daeff-9d287a67.eln*
> -rwxr-xr-x 1 holger holger 140704 Oct  3 09:04 rx-627d8c83-8e412280.eln*
> -rwxr-xr-x 1 holger holger 119264 Oct  3 09:05 sendmail-bcf4df3f-de9a20b1.eln*
> -rwxr-xr-x 1 holger holger  28792 Oct  3 09:06 shadow-87c8aad9-fa6a3d65.eln*
> -rwxr-xr-x 1 holger holger  49616 Oct  3 09:06 sort-14dd51e7-e6a8ba97.eln*
> -rwxr-xr-x 1 holger holger  16056 Oct  2 18:00
> subr--trampoline-61626f72742d7265637572736976652d65646974_abort_recursive_edit_0.eln*
> -rwxr-xr-x 1 holger holger  16056 Oct  2 18:00
> subr--trampoline-6d616b652d70726f63657373_make_process_0.eln*
> -rwxr-xr-x 1 holger holger  16056 Oct  2 18:00
> subr--trampoline-73656c6563742d77696e646f77_select_window_0.eln*
> -rwxr-xr-x 1 holger holger  16024 Oct  2 18:00 subr--trampoline-746f702d6c6576656c_top_level_0.eln*
> -rwxr-xr-x 1 holger holger  49072 Oct  3 09:04 subr-x-02dfef32-177735b4.eln*
> -rwxr-xr-x 1 holger holger  29264 Oct  3 09:05 text-property-search-db1383f6-ed2e2f1e.eln*
> -rwxr-xr-x 1 holger holger  61032 Oct  4 21:08 thingatpt-6fc8a4ab-5c620eb5.eln*
> -rwxr-xr-x 1 holger holger  56680 Oct  3 09:05 time-date-40951a48-f2fbd30f.eln*
> -rwxr-xr-x 1 holger holger  31184 Oct  3 09:05 warnings-28e75f4d-02da775e.eln*
> -rwxr-xr-x 1 holger holger  25088 Oct  3 09:05 yank-media-62540c94-43b16516.eln*
> 
> But some files are still recompiled again and again. Here are two different output from the
> "*Async-native-compile-log*" with two different invocations of "emacs -Q". And somehow the
> cl-loaddefs.el.gz gets compiled twice:
> 
> First one:
> 
> Compilation finished.
> Compiling /usr/local/share/emacs/29.0.50/lisp/emacs-lisp/cl-loaddefs.el.gz...
> uncompressing cl-loaddefs.el.gz...
> uncompressing cl-loaddefs.el.gz...done
> Compiling /usr/local/share/emacs/29.0.50/lisp/thingatpt.el.gz...
> uncompressing thingatpt.el.gz...
> uncompressing thingatpt.el.gz...done
> Compilation finished.
> 
> (above file list is from this point-in-time)
> 
> Next one:
> 
> Compilation finished.
> Compiling /usr/local/share/emacs/29.0.50/lisp/emacs-lisp/cl-loaddefs.el.gz...
> uncompressing cl-loaddefs.el.gz...
> uncompressing cl-loaddefs.el.gz...done
> Compilation finished.
> 
> But despite this, nothing ends up in the eln-cache:
> 
> holger@holger:~$ find ~/.emacs.d/eln-cache/ -name "cl-load*"
> holger@holger:~$ 

cl-loaddefs.el has a "no-native-compile: t" cookie, so it's expected
that you will not find it in the eln-cache.  But all the other
cl-*.eln files are there, as your list above shows.

> But ... it's not only cl-loaddefs.el. My Emacs setup normally is Emacs Doom. So when I start Emacs without
> -Q, I see that 
> 
> Compiling /usr/local/share/emacs/29.0.50/lisp/emacs-lisp/pcase.el.gz...
> uncompressing pcase.el.gz...
> uncompressing pcase.el.gz...done
> 
> pcase.el gets native-compiled. But later ...
> 
> holger@holger:~$ find ~/.emacs.d/eln-cache/ -name "pcase*"
> holger@holger:~$ 
> 
> .. doesn't find anything. So there seem to be more Emacs Lisp libraries that fall through the roster. 

What do you mean by "later"?  Does pcase*.eln appear in the eln-cache,
but gets deleted later, or does it never appear there?

If you start "emacs -Q" and type "M-x load-library RET pcase RET",
does pcase get compiled and deposited into your eln-cache?

And what exactly is the role of "GNU Stow" in this?  Did you try
installing the Emacs you've built with just "make install" instead?