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


Message #11 received at 73318 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 73318 <at> debbugs.gnu.org, larsi <at> gnus.org, acorallo <at> gnu.org
Subject: Re: bug#73318: 31.0.50;
 with-native-compilation=aot breaks exec -a emacs
Date: Tue, 17 Sep 2024 20:47:56 +0300
> 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.




This bug report was last modified 248 days ago.

Previous Next


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