From: "Óscar Fuentes" <ofv@wanadoo.es>
To: emacs-devel@gnu.org
Subject: Re: MSYS2 PATH problems with native compilation
Date: Tue, 07 Dec 2021 17:09:45 +0100 [thread overview]
Message-ID: <87ilw09z1y.fsf@telefonica.net> (raw)
In-Reply-To: 83mtlczh4m.fsf@gnu.org
Eli Zaretskii <eliz@gnu.org> writes:
>> To recap: libgccjit dll is fine, but as.exe/ld.exe/etcetera are not found
>> despite being installed right there along emacs.exe.
>
> So you were talking about libgccjit, but actually meant the assembler
> and the linker programs, not the libgccjit DLL? That was hard to
> guess.
As far as native-comp is concerned, the required feature is the presence
of a functional libgccjit install. In my original message I never
mentioned a dll.
> If the problem is with the Binutils that are invoked as part of the
> compilation, then I think I understand the problem even less. For
> starters, AFAIK we don't search for those in the Emacs code, it's
> libgccjit that invokes them in its own code, according to the rules of
> a "usual" GCC installation. Andrea, am I mistaken? I don't see any
> use of exec-path in the nativecomp code that would look for the
> assembler and the linker, am I missing something?
libgccjit probably uses `system` or some other shell-related mechanism
for invoking the assembler and linker.
> If I'm right, then nothing you do with PATH in Emacs can guarantee
> that native-compilation will find Binutils, because that depends on
> how GCC and Binutils were installed and how they search for the
> programs they need.
Having in PATH the /bin directory where Emacs and gcc are installed
solves the problem.
> IOW, I believe that libgccjit relies on a
> functional GCC installation, including the subprograms under libexec
> and (perhaps) some system header files? I don't even know what it
> expects, because AFAIU its prerequisite is a working GCC and Binutils
> installation.
>
> But if PATH does make a differenceand can solve your problem, by some
> indirect way, then did you try to put the assembler and the linker in
> the libexec/emacs/ tree, where we keep auxiliary programs Emacs
> invokes? Emacs searches there by default.
Duplicating executables here and there just to appease Emacs is a not
very appealing, to say the least. Furthermore, those executables might
need other files present, that scenario is best described as "can of
worms".
>> >> I ask again: would it be ok to add emacs.exe directory to PATH from
>> >> runemacs.exe or emacs.exe itself?
>> >>
>> >> Set PATH for the emacs instances used for generating the .eln files?
>> >
>> > "OK" from what POV?
>>
>> >From your POV, of course. I'm talking about making changes to Emacs.
>
> You want Emacs to change the user's PATH by default?
No, not necessarily. For solving the problem with libgccjit not finding
as/ld, what I want is to set PATH for the emacs.exe instance spawned
for compiling the .eln.
> That'd be unthinkable, IMO.
Currently the user is forced to add emacs.exe to PATH if he wants a
functional native-comp. Not to mention executing tools that are
installed on the same tree as Emacs in general.
> Programs have no business messing with user's PATH,
> since that could easily mess up user's system. E.g., suppose the user
> already has a development environment installed and on PATH: then you
> are silently causing "M-x compile" to use different Binutils programs
> than what the user intended.
Not if emacs.exe directory is appended. However, I'm proposing to set
PATH transiently, see above.
>> The general problem is that Emacs is installed along all the tools it
>> needs, but they are invisible to Emacs unless you explicitly say "they
>> are right there where you are!". That's not the experience we get on
>> GNU/Linux and other systems, where Emacs has no problem finding any
>> executable as long as it is installed where the package manager puts it
>> by default.
>
> I don't know what kind of GNU/Linux installations you have in mind,
> but I don't know about any reliable installation technique that causes
> all the installed tools to seamlessly work together, except by either
> modifying PATH or installing all the tools in the same common tree.
Precisely, MSYS2/Mingw-w64 installs everything in the same tree.
> Anything else is much more complex and fragile. Having several
> incompatible development environments on the same machine active
> simultaneously is IME a very rare use case,
In MSYS2/Mingw-w64 it is quite common.
> but if your users do that
> frequently, and you don't have some system of batch files/scripts to
> easily and reliably switch between the environments, then your users
> are in for a lot of trouble.
Well, that's something for the user to care about. Our job is to provide
an Emacs that works as installed, and right now native-comp is broken
unless the user sets PATH globally.
next prev parent reply other threads:[~2021-12-07 16:09 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-01 15:04 msys2 build path problems + copy-paste english results in chinese characters arthur miller
2021-12-01 15:55 ` Lars Ingebrigtsen
2021-12-01 18:32 ` Arthur Miller
2021-12-01 18:50 ` Lars Ingebrigtsen
2021-12-01 22:42 ` Arthur Miller
2021-12-01 16:46 ` Eli Zaretskii
2021-12-01 18:25 ` Arthur Miller
2021-12-01 18:44 ` Eli Zaretskii
2021-12-01 22:39 ` Arthur Miller
2021-12-01 23:01 ` Óscar Fuentes
2021-12-02 7:19 ` Eli Zaretskii
2021-12-02 9:42 ` Óscar Fuentes
2021-12-02 10:05 ` Eli Zaretskii
2021-12-02 15:40 ` Óscar Fuentes
2021-12-02 18:05 ` Eli Zaretskii
2021-12-05 8:43 ` Arthur Miller
2021-12-06 0:38 ` MSYS2 PATH problems with native compilation (was: msys2 build path problems + copy-paste english results in chinese characters) Óscar Fuentes
2021-12-06 14:32 ` Eli Zaretskii
2021-12-06 22:48 ` MSYS2 PATH problems with native compilation Óscar Fuentes
2021-12-07 13:20 ` Eli Zaretskii
2021-12-07 16:09 ` Óscar Fuentes [this message]
2021-12-07 17:07 ` Eli Zaretskii
2021-12-07 21:13 ` Óscar Fuentes
2021-12-08 12:34 ` Eli Zaretskii
2021-12-02 7:17 ` msys2 build path problems + copy-paste english results in chinese characters Eli Zaretskii
[not found] ` <AM9PR09MB4977B43C2FC19514E4385B5E966C9@AM9PR09MB4977.eurprd09.prod.outlook.com>
2021-12-05 10:17 ` Eli Zaretskii
2021-12-05 10:57 ` Arthur Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ilw09z1y.fsf@telefonica.net \
--to=ofv@wanadoo.es \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).