From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ship Mints Newsgroups: gmane.emacs.bugs Subject: bug#73318: 31.0.50; with-native-compilation=aot breaks exec -a emacs Date: Tue, 17 Sep 2024 14:14:54 -0400 Message-ID: References: <864j6eb29f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000003d3bf6062254ab84" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37468"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Spencer Baugh , larsi@gnus.org, acorallo@gnu.org, 73318@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 17 20:18:50 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 1sqcmo-0009cX-3p for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Sep 2024 20:18:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqcl3-0004Ru-51; Tue, 17 Sep 2024 14:17:03 -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 1sqckp-0003fV-PF for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 14:16:54 -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 1sqckp-0003Jx-Fn for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 14:16:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=SZmHAmm61uJQQ4AyDmmpZwCRO40lvUsF1eQk/75Op5g=; b=N99jrHXBFcAQVQ8Fld8K7wyiXOozrSQ97IFG/yuR7p37tP3e9WShxedeWC8uZ7P8pTPRDNnkiXfOkV/NVteihmTMaBQcPFVnYQTKVPkMsvVtOpbTzyktCpsqoGVlqkRIt4riti+XGcoYvbdZ4XN6oECgpOk0whFGjDHYH+nWPHQ+nwiU9CcMolB0jcEe2Ey+YfzbhkWTNBvy/rZjHrHVzgm6QXSZcU3BOoteQ68WGBUeeqB31QgBeLYje4QxwS/4qNe6dDTc4S9BcCOKLwbbjmanPq+nwZNwRWjWzFKXTxELbCBEnYxAs5Ro0qmrsf7NKDK1epRWTe+5DlX62m6beg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqcl4-00048T-Cs for bug-gnu-emacs@gnu.org; Tue, 17 Sep 2024 14:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ship Mints Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Sep 2024 18:17:02 +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.172659699815814 (code B ref 73318); Tue, 17 Sep 2024 18:17:02 +0000 Original-Received: (at 73318) by debbugs.gnu.org; 17 Sep 2024 18:16:38 +0000 Original-Received: from localhost ([127.0.0.1]:55899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqckc-00046f-B4 for submit@debbugs.gnu.org; Tue, 17 Sep 2024 14:16:38 -0400 Original-Received: from mail-vk1-f177.google.com ([209.85.221.177]:43021) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqckU-00045o-Hu for 73318@debbugs.gnu.org; Tue, 17 Sep 2024 14:16:30 -0400 Original-Received: by mail-vk1-f177.google.com with SMTP id 71dfb90a1353d-501213e5ad4so1009e0c.0 for <73318@debbugs.gnu.org>; Tue, 17 Sep 2024 11:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726596906; x=1727201706; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SZmHAmm61uJQQ4AyDmmpZwCRO40lvUsF1eQk/75Op5g=; b=QKtdOP8EgRLaXw4k9oqZgDnNOKwm31wSEld1QBZVIhkGAT2tdHs+rm+Uz+38jhw8o5 ulfI6+i/WdySi9B1z7yMGP9ytqWucisTsa4b4zvwbW6qsc793TpsOBWkM9G/fbeBv47J /h3vyY/Tq4B+yeIGB6JLYOh4Ka2g1O4L/Fn6z+g52jGT3Fa/c+TOEB4ZNMKGIiZWszz1 aavcEAFXSdn6kDvh3s1q8+MoTuJorcjxV0T/MmZVkxekizsTBeiby3qee/nIKOcSDDvo +y4aIzmiSMIKdvhTdrsRRG61JTcPSmJUpzXohaUWbB+fDQN6ILuqUZ6D1AmcsDfoCgqH Fibw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726596906; x=1727201706; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SZmHAmm61uJQQ4AyDmmpZwCRO40lvUsF1eQk/75Op5g=; b=Q/CEy66FpqfJZZKadRF05N+peZm1KsMM3Pw7ohjz5od/kiyaGZcLZlCftynhJb4nrF GA2IUhx38cmi/6VAbciMLnWjSgwp1QSa4Z6cH6hyLOH/lB+mPbiyejan2YMlkJbBOqOd Iu4GfpOPpIRZC1e8Rjd0f0ASXwUGggoD4pSc8F3EjZmjOtGyT+9p1RdrAntkzNEKvGcj +n6b0Nx/F7iq+lEF9AeSfkx3ByOGxsD+jjAk9wzMNKPFxzKgUXUDKeAwzDmhQ9oU1oyI LbbnRsdUrsmEitmYooN8l+e8GJW/DvmfZ0sRR6IisId9TD7zV3BKErMCHP7Q7Z/poh5O 1Frw== X-Forwarded-Encrypted: i=1; AJvYcCVpC7jZVY2Bs2dXQmSnEvkvhURWaWReFOk7WUgG5OtlJlxrRa/4dAwsQRUvI3KFb0ppFWdTtw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyCFwUbHBomw8CLM7bGuHyr/em7n6itfyXZgmuaFzl4vdyYhwAg aA9eMwJwtR4gbtjDvLIKDUqT3s6m/YCjM9WNdfyh/fgnKyj7aAbpsPc8hRJDbYVXQUbs8Blodc4 tNRmsek+hNqCRT6bbNwKOb/nT9vA= X-Google-Smtp-Source: AGHT+IF88CWHGpQPPk2smgdwdswd8oVtZahIEBIApXG6M9AZnEu3n1FhuZxPf3p8rWqRJ5nrzuPYFGvAfVpmzFWCLk4= X-Received: by 2002:a05:6122:2002:b0:4f2:ffa6:dbd5 with SMTP id 71dfb90a1353d-502f76f0ff3mr22734814e0c.6.1726596905776; Tue, 17 Sep 2024 11:15:05 -0700 (PDT) In-Reply-To: <864j6eb29f.fsf@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:291956 Archived-At: --0000000000003d3bf6062254ab84 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFPM Eli Zaretskii wrote: > > 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=3Daot, e.g.= : > > prefix=3D~/prefix > > mkdir $prefix > > ./configure --with-native-compilation=3Daot --prefix=3D$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/+s= hare+/app/emacs/bin/: > > emacs: > /usr/local/home/sbaugh/workspaces/24833141-bffb-3c99-a9d6-c366d37c4f5e/+s= hare+/app/emacs/bin/../native-lisp/31.0.50-a88a37f5/preloaded/minibuffer-b2= d9c221-284ab177.eln: > cannot open shared object file: No such file or directory > > > > "exec -a emacs" works fine for with-native-compilation=3Dyes or > > with-native-compilation=3Dno. > > 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. > > > > --0000000000003d3bf6062254ab84 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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=C2=A0https://gn.= googlesource.com/gn/+/refs/heads/main/src/util/exe_path.cc
<= br>
On Tue,= Sep 17, 2024 at 1:51=E2=80=AFPM Eli Zaretskii <eliz@gnu.org> wrote:
> Cc: Lars Ingebrigtsen <larsi@gnus.org>, Andrea Corallo <acorallo@gnu.org><= br> > Date: Tue, 17 Sep 2024 11:18:41 -0400
> From:=C2=A0 Spencer Baugh via "Bug reports for GNU Emacs,
>=C2=A0 the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
>
> 1. Compile and install Emacs with --with-native-compilation=3Daot, e.g= .:
> prefix=3D~/prefix
> mkdir $prefix
> ./configure --with-native-compilation=3Daot --prefix=3D$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-3c= 99-a9d6-c366d37c4f5e/+share+/app/emacs/bin/:
> emacs: /usr/local/home/sbaugh/workspaces/24833141-bffb-3c99-a9d6-c366d= 37c4f5e/+share+/app/emacs/bin/../native-lisp/31.0.50-a88a37f5/preloaded/min= ibuffer-b2d9c221-284ab177.eln: cannot open shared object file: No such file= or directory
>
> "exec -a emacs" works fine for with-native-compilation=3Dyes= or
> with-native-compilation=3Dno.

Invocation via "exec -a" is not supported, if it messes with the<= br> leading directories of the argv[0] value passed to Emacs.=C2=A0 That's<= br> 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.=C2=A0 We do<= br> 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.



--0000000000003d3bf6062254ab84--