Subject: bug#47800: [native-comp] could not resolve realpath of "emacs"

From: Eli Zaretskii <[email-masked]>
Date: Fri, 16 Apr 2021 22:38:28 +0300

> From: Andrea Corallo <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked]
> Date: Fri, 16 Apr 2021 19:23:51 +0000
> 
> >> >   char *filename = real_filename (SSDATA (raw_name));
> >> 
> >> I agree that's the issue.
> >
> > I think the issue is slightly more complex.
> 
> That's very possible today I had really no time to reproduce and
> investigate this in details sorry.
> 
> > Andrea, is native-compilation supported with unexec, or only with
> > pdumper?
> 
> Only pdumper.

OK, that simplifies the solution.

The problem we need to solve is that we have two decisions that run in
parallel, but are not really synchronized: where to look for the
pdumper file and where to look for the *.eln files.  These two must
correspond to each other, but currently they have little in common,
which is a problem waiting to bite us.

The other issue is the reliance on Vinvocation_directory.  To rely on
it, we must change how and when it is computed, and that will most
probably change its value in some use cases.  So I think we need to
leave the Vinvocation_directory calculation as it was before, in
init_cmdargs, and use other variables to tell pdumper_load how to
resolve the native-lisp directory when restoring from the pdumper
file.

I'm currently working on making these changes, and hope to have a
solution which will solve all the known issues with symlinks etc.