Subject: bug#55052: 28.0.92; confusing/wrong warning-error message from native comp

From: Ken Raeburn <[email-masked]>
Date: Wed, 20 Apr 2022 23:29:28 -0400

I restarted emacs and got this message in a *Warnings* buffer:

Warning (comp): /home/raeburn/elisp/kr-irc.el: Error: File is missing Cannot open load file

First, there’s the obvious confusion between “warning” and “error” here.
Second, the named file most certainly does exist.  It’s one I set to
eval-after-load when rcirc is run.  If I try M-x load-library RET kr-irc
RET, the message appears again.

I can invoke (native-compile ...) with the full pathname, and that seems
to work; I get a .eln pathname back as the return value, and after that,
load-library doesn’t complain.  If I delete the named .eln file, the
load-library complaints come back.

I tried deleting the whole eln-cache tree to see what would happen.  The
.eln files for everything I installed from ELPA/MELPA got rebuilt fine,
with a few minor warnings, but kr-irc.el triggered the warning-error
again.  I was initially suspicious that compiling files from my ~/elisp
directory might be a problem somehow, but it seems that .eln files were
regenerated for three other files without problems.

The code in comp-run-async-workers does a pretty good job of packaging
up all the compilation work into one function with no easy way to
instrument any of it, but after applying some before-advice to
make-process to pull out the subprocess command and the temporary
filename, and copy the file to look at, I was able to run the subprocess
command directly.  Unfortunately, it gave no more helpful messages, but
at least I was then dealing with the process that actually got the
error.  I could then run it under strace, and found my problem: A
“require” of a library that isn’t in the load-path, but was explicitly
loaded by my init file.

My init code does
  (load-library "smart-quotes/smart-quotes")
during startup, but kr-irc.el has
  (require 'smart-quotes)
and the smart-quotes directory isn’t in my load-path.

Obviously, the bug at the root of this was mine, and easily fixed now
that I know it.  But the error messages given were misleading if not
outright wrong, and the structure of the code makes it a struggle to
debug it.

In GNU Emacs 28.0.92 (build 1, x86_64-redhat-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars)
 of 2022-03-20 built on 5bed50ec23174a34b43f6166b598ee0b
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Fedora Linux 35 (Workstation Edition)

Configured using:
 'configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=lucid
 --with-gpm=no --with-modules --with-harfbuzz --with-cairo --with-json
 --with-native-compilation build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2
 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches
 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
 -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-z,relro
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XAW3D XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  rcirc-track-minor-mode: t
  display-time-mode: t
  desktop-save-mode: t
  global-edit-server-edit-mode: t
  which-function-mode: t
  icomplete-mode: t
  shell-dirtrack-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/raeburn/.emacs.d/elpa/systemtap-mode-20151122.1940/systemtap-mode hides /usr/share/emacs/site-lisp/systemtap-mode
/home/raeburn/.emacs.d/elpa/p4-20150721.1937/p4 hides /usr/share/emacs/site-lisp/perforce/p4
/home/raeburn/.emacs.d/elpa/transient-20211101.2251/transient hides /usr/share/emacs/28.0.92/lisp/transient

Features:
(shadow sort mail-extr cl-print ielm pp emacsbug sendmail mule-util
jka-compr misearch multi-isearch add-log ob-shell rcirc gnus-art mm-uu
mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom
gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range message
rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search
mail-utils mm-util mail-prsvr wid-edit time desktop frameset cus-load
kr-init docker-tramp tramp-cache vagrant-tramp dash tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat parse-time ls-lisp
org-protocol org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete org-list org-faces
org-entities noutline outline org-version ob-emacs-lisp ob-core ob-eval
org-table oc-basic bibtex iso8601 time-date ol org-keys oc org-compat
org-macs org-loaddefs format-spec find-func cal-menu calendar
cal-loaddefs edit-server advice smart-quotes easy-mmode which-func imenu
icomplete server term disp-table shell pcomplete ehelp comint ansi-color
ring hi-lock comp comp-cstr warnings cl-extra help-mode finder-inf rx
info package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 326951 25999)
 (symbols 48 23700 0)
 (strings 32 88713 10549)
 (string-bytes 1 3032841)
 (vectors 16 44055)
 (vector-slots 8 757424 25820)
 (floats 8 333 44)
 (intervals 56 6816 318)
 (buffers 992 20))