GNU bug report logs - #73318
31.0.50; with-native-compilation=aot breaks exec -a emacs

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Tue, 17 Sep 2024 15:20:01 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Ship Mints <shipmints <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Spencer Baugh <sbaugh <at> janestreet.com>, larsi <at> gnus.org, acorallo <at> gnu.org, 73318 <at> debbugs.gnu.org
Subject: bug#73318: 31.0.50; with-native-compilation=aot breaks exec -a emacs
Date: Tue, 17 Sep 2024 14:14:54 -0400
[Message part 1 (text/plain, inline)]
Google's build system, gn, used for Chromium, et.al., has support for this
which can provide some inspiration for most of the major platforms on which
Emacs runs; qv
https://gn.googlesource.com/gn/+/refs/heads/main/src/util/exe_path.cc

On Tue, Sep 17, 2024 at 1:51 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, Andrea Corallo <acorallo <at> gnu.org
> >
> > Date: Tue, 17 Sep 2024 11:18:41 -0400
> > From:  Spencer Baugh via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >
> >
> > 1. Compile and install Emacs with --with-native-compilation=aot, e.g.:
> > prefix=~/prefix
> > mkdir $prefix
> > ./configure --with-native-compilation=aot --prefix=$prefix
> > make -j64 && make install
> > 2. Run emacs with "exec -a" to change its argv[0]:
> > sh -c "exec -a emacs $prefix/bin/emacs -Q --batch"
> > 3. Observe an error like:
> > Error using execdir
> /usr/local/home/sbaugh/workspaces/24833141-bffb-3c99-a9d6-c366d37c4f5e/+share+/app/emacs/bin/:
> > emacs:
> /usr/local/home/sbaugh/workspaces/24833141-bffb-3c99-a9d6-c366d37c4f5e/+share+/app/emacs/bin/../native-lisp/31.0.50-a88a37f5/preloaded/minibuffer-b2d9c221-284ab177.eln:
> cannot open shared object file: No such file or directory
> >
> > "exec -a emacs" works fine for with-native-compilation=yes or
> > with-native-compilation=no.
>
> Invocation via "exec -a" is not supported, if it messes with the
> leading directories of the argv[0] value passed to Emacs.  That's
> because the search for the preloaded *.eln files is based on the
> directory in which the Emacs executable is installed, as passed via
> argv[0], and breaks if "exec -a" messes with that.
>
> IOW, "don't do that, it will hurt".
>
> P.S. If someone knows how to teach Emacs how to find the absolute file
> name of its executable without depending on argv[0], speak up.  We do
> that on Windows, but not on Posix platforms, since (I'm being told)
> there's no reliable way of having that on GNU/Linux and other Posix
> platforms.
>
>
>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.