Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1038210: please provide a way to use UCRT instead of MSVCRT

225 views
Skip to first unread message

Sébastien Villemot

unread,
Jun 16, 2023, 10:52:05 AM6/16/23
to
Source: gcc-mingw-w64
Version: 25.2
Severity: wishlist

Dear Maintainer,

Recent versions of Windows ship a newer C runtime, UCRT, meant to supersede the
historical one, MSVCRT.

In particular, the MSYS2 project now produces packages compiled against UCRT
and considers them as the recommended ones:
https://www.msys2.org/docs/environments/

Currently, MinGW cross-compilers in Debian produce binaries linked against
MSVCRT. It would be nice if there was an easy and supported way of producing
binaries linked against UCRT.

As I understand it, there are two ways of achieving this:

1. at compile time of src:gcc-mingw-w64, by passing option
--with-default-msvcrt=ucrt

2. at runtime, by passing a modified specs file to the cross-compiler (more
specifically, replacing -lmsvcrt by -lucrt in the libgcc section)

Option 2 already works with the current version of src:gcc-mingw-w64. But it
would be better if there was an easier and less tricky way of achieving the
same (for example by providing different package flavours; or by providing a
specs file explictly designed for that purpose, possibly activated by the
alternatives system).

Thanks for your work,

--
⢀⣴⠾⠻⢶⣦⠀ Sébastien Villemot
⣾⠁⢠⠒⠀⣿⡁ Debian Developer
⢿⡄⠘⠷⠚⠋⠀ https://sebastien.villemot.name
⠈⠳⣄⠀⠀⠀⠀ https://www.debian.org

Sébastien Villemot

unread,
Jun 16, 2023, 11:12:15 AM6/16/23
to
Le vendredi 16 juin 2023 à 16:42 +0200, Sébastien Villemot a écrit :
> 2. at runtime, by passing a modified specs file to the cross-compiler (more
> specifically, replacing -lmsvcrt by -lucrt in the libgcc section)

Actually I realize that this solution probably does not work very
reliably, in particular for C++ programs (because libstdc++ would still
be built against MSVCRT).

So the only reliable solution may be to provide different binary
packages with cross-compilers for UCRT.
signature.asc

Stephen Kitt

unread,
Jun 17, 2023, 10:51:24 AM6/17/23
to
On Fri, 16 Jun 2023 17:00:19 +0200, Sébastien Villemot <seba...@debian.org>
wrote:
> Le vendredi 16 juin 2023 à 16:42 +0200, Sébastien Villemot a écrit :
> > 2. at runtime, by passing a modified specs file to the cross-compiler
> > (more specifically, replacing -lmsvcrt by -lucrt in the libgcc section)
>
> Actually I realize that this solution probably does not work very
> reliably, in particular for C++ programs (because libstdc++ would still
> be built against MSVCRT).

Right, that wouldn’t work — or rather, it would work in some cases but not in
others...

> So the only reliable solution may be to provide different binary
> packages with cross-compilers for UCRT.

I’m leaning towards taking the same approach as Fedora, using a new triplet,
...-w64-mingw32ucrt (see https://fedoraproject.org/wiki/Changes/F37MingwUCRT
for details and
https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/CAMxuvax0nSO5%2BMRNQG%3DkBiN%3DPPAFbXrzAR-OVgS0kiKoVPeWSw%40mail.gmail.com/
for a very brief discussion with upstream).

Regards,

Stephen
0 new messages