From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73318: 31.0.50; with-native-compilation=aot breaks exec -a emacs Date: Tue, 17 Sep 2024 20:47:56 +0300 Message-ID: <864j6eb29f.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7522"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73318@debbugs.gnu.org, larsi@gnus.org, acorallo@gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 17 19:51:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sqcMB-0001nN-JG for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Sep 2024 19:51:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqcLh-0003rj-K4; Tue, 17 Sep 2024 13:50:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqcLf-0003r7-I1 for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 13:50:47 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sqcLf-0008OP-9z for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 13:50:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=KkthZnFNWP7EotX2ZUxIPjZkiXHByTOkt0R429GkCno=; b=CTZVtoD8ZfaPMXE+KQGUoXPtv6IO6aXDocsmrAHQ+LVkD3/xT8h6CQJrhLI/EywBfjml+yiaff9eZgZyvOqvmoHYBHGAlEL7HOtpqedgHkOE2lImYqy7urSK5xQdfSAMrDt3xipC1V5ajiXul8hEcyC8yajIoGQhD+sBKIMbXk6WkdUhYwNApmyL6Xkd5pkJWltVbwS2WFt55uInNSt7C/qUOxEtES4mXTe/aBsSgtK09e/V1lzbvRiTOeuhHBBmCTnMVB047uVZdGnRjwJS4jb67JnKIXvsvQ5SkjbgJS3LJRqyatC3l9QsUsxdwdYnvD/tuy5Jyjy/6SXvgnF79Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqcLt-0002hC-Vd for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 13:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Sep 2024 17:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73318 X-GNU-PR-Package: emacs Original-Received: via spool by 73318-submit@debbugs.gnu.org id=B73318.172659543310319 (code B ref 73318); Tue, 17 Sep 2024 17:51:01 +0000 Original-Received: (at 73318) by debbugs.gnu.org; 17 Sep 2024 17:50:33 +0000 Original-Received: from localhost ([127.0.0.1]:55880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqcLR-0002gN-Eb for submit@debbugs.gnu.org; Tue, 17 Sep 2024 13:50:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60106) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqcLP-0002g7-H4 for 73318@debbugs.gnu.org; Tue, 17 Sep 2024 13:50:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqcIx-00083W-MA; Tue, 17 Sep 2024 13:47:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=KkthZnFNWP7EotX2ZUxIPjZkiXHByTOkt0R429GkCno=; b=otn5s87xIxPE ZARC641fmY04VFDNS71tfQgN95wigVKsQJ1jpprAZh2Ql2j4xzNrap9e9buO4y5Qp+4sIWwkPmONN T7CcMuyvpzzqzbO+CUhmnAFjG/MzfpuXQcZt1I3ScOvaa9RpMV00ZUcdE7yQ5lrwA6ucuR5koxpXI 29gqQAL6tq6D+ooZda3Aev86/WXXWpDIXabAcLxoF9pMyMeOApvnqzl5ShsYpbGetEq+prAzRuj4+ /I6j0MzEkiDrcb7zu56otyV9eLxK4VqvByzJI8cmYAVRfIBiF0b/0VnMhjdtYcV76+Ssri/GEuRBt OImbfv7ndMj5HJvjJexy4A==; In-Reply-To: (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291954 Archived-At: > Cc: Lars Ingebrigtsen , Andrea Corallo > 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" > > > 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.