From: Eli Zaretskii <eliz@gnu.org>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: emacs-devel@gnu.org
Subject: Re: MinGW build on master fails with Error 127
Date: Sat, 24 Dec 2022 20:09:48 +0200 [thread overview]
Message-ID: <83pmc84qs3.fsf@gnu.org> (raw)
In-Reply-To: <878riw1y70.fsf@telefonica.net> (message from Óscar Fuentes on Sat, 24 Dec 2022 18:57:55 +0100)
> From: Óscar Fuentes <ofv@wanadoo.es>
> Cc: emacs-devel@gnu.org
> Date: Sat, 24 Dec 2022 18:57:55 +0100
>
> MSYS2 distributes multiple toolset/c-runtime combinations. Toolsets can
> be GNU (gcc, binutils, etc) or Clang, and c-runtime can be either
> mingw-w64 or UCRT. For a given combination the toolset is configured to
> work with a c-runtime, so it already knows what it needs to do the right
> thing. I guess it is possible to override the configuration of a toolset
> so to use a different c-runtime, but that's not something that MSYS2
> encourage.
>
> > And what can users do to force MinGW64 to link against MSVCRT, if they
> > so wish?
>
> The MSYS2 distribution named "MINGW64" already links to MSVCRT, as
> always did, and that will not change. Is the UCRT64 distribution the one
> that provides a gcc/binutils/everything-else that links to UCRT.
So if the user has the UCRT version installed, they will necessarily
link against UCRT64.
Does the wording in nt/INSTALL.W64 guide users to only one of these
two variants (and if so, to which one), or is it generic, and the user
will have to choose when they install MinGW?
> >> There is a patch specific for UCRT support. It's quite simple although
> >> the workaround for close_stream doesn't inspire confidence, hints that
> >> there might be subtle differences on the behavior of C runtime
> >> functions.
> >
> > It's a beginning of a very long journey, to learn about UCRT what
> > we've invested decades to learn about MSVCRT.
>
> AFAIK UCRT should work just fine (TM) as it is not an entirely new C
> Runtime, but a vastly updated version of MSVCRT with a new model of
> deployment for more robust versioning that allows incremental additions.
> I'm sure there are subtle differences and even some intended departure
> from behaviors that are deemed undesirable, though.
Subtle differences do exist, as that patch demonstrates.
Whether it will be painless for Emacs depends on how much of the
sources of MSVCRT was inherited by UCRT. There are some quirks in
MSVCRT that took us time to find out and accommodate for, and w32.c
mentions that in several places.
> My experience, both with my own projects and with the packages MSYS2
> distributes, indicate that migrating to it is fairly painless, if
> noticeable at all.
See above: Emacs is quite demanding in this regard, so I'm not as
optimistic as you are, having spent enough hours reading the MSVCRT
sources and documentation.
> > And the patch indeed is not really acceptable, as it disables useful
> > behavior without a reasonable explanation.
>
> The commit message says "fclose fail during atexit as if they were
> already closed" but indeed it doesn't describe a user-visible problem. I
> can ask for more details, if you are interested.
I am. And note that the MS documentation shows an example where an
atexit function calls printf, so the standard streams are not really
closed at that time. Something else is at work here, probably.
> > Are the sources of UCRT available somewhere (as MSVCRT sources were)?
>
> They are distributed with Visual Studio. They are missing from a
> Community (the gratis version) install that I have around, but maybe I
> didn't check the option for installing them.
IME, being able to examine the sources was invaluable in quickly
resolving some issues.
next prev parent reply other threads:[~2022-12-24 18:09 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 15:26 MinGW build on master fails with Error 127 Loreno Heer
2022-12-12 15:40 ` Eli Zaretskii
2022-12-12 15:44 ` Loreno Heer
2022-12-12 15:56 ` Eli Zaretskii
2022-12-12 16:03 ` Loreno Heer
2022-12-12 16:11 ` Eli Zaretskii
2022-12-12 16:54 ` Loreno Heer
2022-12-23 21:45 ` Loreno Heer
2022-12-24 6:36 ` Eli Zaretskii
2022-12-24 14:18 ` Loreno Heer
2022-12-24 14:43 ` Eli Zaretskii
2022-12-24 15:11 ` Loreno Heer
2022-12-24 15:44 ` Eli Zaretskii
2022-12-24 22:50 ` Loreno Heer
2022-12-24 15:31 ` Óscar Fuentes
2022-12-24 15:50 ` Eli Zaretskii
2022-12-24 16:14 ` Óscar Fuentes
2022-12-24 16:46 ` Eli Zaretskii
2022-12-24 16:58 ` Óscar Fuentes
2022-12-24 17:08 ` Óscar Fuentes
2022-12-24 17:20 ` Eli Zaretskii
2022-12-24 17:57 ` Óscar Fuentes
2022-12-24 18:09 ` Eli Zaretskii [this message]
2022-12-24 18:56 ` Óscar Fuentes
2022-12-24 19:10 ` Eli Zaretskii
2022-12-25 2:46 ` Óscar Fuentes
2022-12-25 8:29 ` Eli Zaretskii
2022-12-25 14:25 ` Óscar Fuentes
2022-12-26 13:02 ` Eli Zaretskii
2022-12-26 13:33 ` Óscar Fuentes
2022-12-24 19:19 ` Óscar Fuentes
2022-12-24 19:27 ` Eli Zaretskii
2022-12-25 0:13 ` Po Lu
2022-12-25 0:48 ` Óscar Fuentes
2022-12-25 6:46 ` Eli Zaretskii
2022-12-24 18:03 ` Óscar Fuentes
2022-12-24 18:49 ` Eli Zaretskii
2022-12-24 19:23 ` Óscar Fuentes
2022-12-24 19:29 ` Eli Zaretskii
2022-12-24 19:44 ` Óscar Fuentes
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=83pmc84qs3.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=ofv@wanadoo.es \
/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).