Subject: Re: bug#46256: [feature/native-comp] AOT eln files ignored if run from build tree

From: Eli Zaretskii <[email-masked]>
Date: Wed, 03 Mar 2021 20:27:55 +0200

Progress report:

 . I've successfully build a 32-bit Emacs --with-wide-int on
   MS-Windows, for now _without_ NATIVE_FULL_AOT=1.

 . The built Emacs crashes on startup in interactive invocations from
   cmd.exe, if invoked as "emacs -Q" or "src/emacs -Q".  This was
   traced to set_invocation_vars, which calls openp, which calls
   expand-file-name, which on MS-Windows expects the emacs_dir
   variable to be defined in the environment -- but this is false at
   that point, because init_environment was not yet called.

   I fixed this by avoiding the call to openp (MS-Windows executables
   have an easy way of determining their full absolute file name), but
   in general I must say that the call to init_vars_for_load in
   pdumper_load worries me quite a bit: this is a very early stage in
   startup, before we init most of our infrastructure, and so relying
   on file-name functions, memory allocation, etc. is very dangerous,
   especially on Windows, where the infrastructure not yet initialized
   at that point includes the environment.

 . After fixing the above, Emacs starts, but as soon as some simple
   command is invoked, and Emacs starts native-compiling Lisp
   packages, the Emacs subprocesses which run the async compilation
   start crashing.  Not all of them crash, but some do.  I wasn't yet
   able to find where they crash or why; stay tuned.