Subject: bug#51999: 28.0.60; temacs with native-compilation fails unless invoked from src

From: Eli Zaretskii <[email-masked]>
Date: Sat, 20 Nov 2021 17:12:03 +0200

>   . On GNU/Linux:
> 
>     - cd src && ./temacs -Q -nw works as expected
>     - ./src/temacs -Q -nw fails with this error message:
> 
>       Symbol's function definition is void: internal-echo-keystrokes-prefix
> 
>   . On MS-Windows:
> 
>     - cd src && ./temacs -Q -nw works as expected
>     - ./src/temacs -Q -nw works, but loads *.elc files instead of *.eln
> 
> In all the cases, temacs was invoked from the build directory.  I
> don't understand why the different behavior.  Any ideas?

Answering myself: here's the reason:

    DEFVAR_LISP ("native-comp-eln-load-path", Vnative_comp_eln_load_path,
		 doc: /* List of eln cache directories.

  If a directory is non absolute is assumed to be relative to
  `invocation-directory'.
  `comp-native-version-dir' value is used as a sub-folder name inside
  each eln cache directory.
  The last directory of this list is assumed to be the system one.  */);

    /* Temporary value in use for bootstrap.  We can't do better as
       `invocation-directory' is still unset, will be fixed up during
       dump reload.  */
    Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil);

So invoking temacs from any directory that is not a sibling of
native-lisp will fail to find the *.eln files.