On Nov 16, 2024, at 4:26 PM, Andrea Corallo <acorallo@gnu.org> wrote:


Hi Devlin,

yes this difference is expected, 'native-compile' runs the compilation
in the loaded Emacs so that all the definitions of loaded packages are
known to the compiler.  'native-compile-async' runs in a new fresh Emacs
so all requires need to be there in the compilation unit in order to let
the compiler be able to load the definitions.

We have also some doc in (info "(elisp) Native-Compilation Variables")
which goes like this:

   A common cause for asynchronous native-compilation to produce
    warnings is compiling a file that is missing some ‘require’ of a
    necessary feature.  The feature may be loaded into the main emacs,
    but because native compilation always starts from a subprocess with
    a pristine environment, that may not be true for the subprocess.

Regards

 Andrea

I see. Thanks for the explanation and the documentation reference!

Sean