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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 21 Apr 2022 08:56:48 +0300

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

It isn't a confusion.  The "error" part came from the subprocess that
tried to natively-compile the file: for that process, this was a fatal
error.  The "warning" part came from the foreground session which
launched the subprocess; for that session, this is merely a warning,
because it is still functional, it just will use the .elc or the .el
version of the package.

> Obviously, the bug at the root of this was mine, and easily fixed now
> that I know it.

These are the usual reasons for problems in native-compilation which
don't seem to exist when you byte-compile the file in your customized
Emacs session: the native-compilation is done in a separate process
that starts pristine and doesn't load your init files, so any such
implicitly assumed loaded features cause errors and warnings.

> But the error messages given were misleading if not outright wrong,
> and the structure of the code makes it a struggle to debug it.

I agree that it is hard to debug these problems, and would welcome any
changes to make that easier.  As a simple but important improvement,
how about a variable that would cause the subprocess emit much more
detailed information about the problem?

> 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

Please switch to the official Emacs 28.1, instead of running a
pretest.

Thanks.