Skip to content

Commit c17f5ca

Browse files
committed
Use --with-default-msvcrt=msvcrt-os with Mingw-w64
The Mingw-w64 default may change to UCRT in the future, possibly soon, but w64devkit will continue with the original msvcrt.dll for as long as possible. It has far better compatibility with older systems, and UCRT has limited availability prior to Windows 10. The only benefits of linking UCRT that I know are better compatibility when statically linking with UCRT-based toolchains, particularly MSVC, and actually-working assertions (something Mingw-w64 could fix, as it does printf, etc.). That's it! Mingw-w64 already fills in the missing C99 bits. The Mingw-w64 documentation vaguely mentions a UTF-8 locale, but it is either false or useless depending on the meaning. UCRT has all the same narrow API limitations of MSVCRT — *the* biggest and thorniest issue with Windows CRTs. Trading away a ton of backwards compatibility just for better static linking with MSVC sounds like a poor cost-benefit trade-off. In that light, the choice of CRT seems obvious regardless of the Mingw-w64 default. My own view is that Windows CRTs have been poorly implemented and are generally not worth using, so they should be avoided in the first place, i.e. define {main,WinMain}CRTStartup, call Win32 directly, and compile with -nostartfiles. https://sourceforge.net/p/mingw-w64/mailman/message/37853546/
1 parent 2617b47 commit c17f5ca

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ WORKDIR /x-mingw-headers
9090
RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
9191
--prefix=/bootstrap/$ARCH \
9292
--host=$ARCH \
93+
--with-default-msvcrt=msvcrt-os \
9394
&& make -j$(nproc) \
9495
&& make install
9596

@@ -127,6 +128,7 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
127128
--prefix=/bootstrap/$ARCH \
128129
--with-sysroot=/bootstrap/$ARCH \
129130
--host=$ARCH \
131+
--with-default-msvcrt=msvcrt-os \
130132
--disable-dependency-tracking \
131133
--disable-lib32 \
132134
--enable-lib64 \
@@ -212,6 +214,7 @@ WORKDIR /mingw-headers
212214
RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
213215
--prefix=$PREFIX/$ARCH \
214216
--host=$ARCH \
217+
--with-default-msvcrt=msvcrt-os \
215218
&& make -j$(nproc) \
216219
&& make install
217220

@@ -220,6 +223,7 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
220223
--prefix=$PREFIX/$ARCH \
221224
--with-sysroot=$PREFIX/$ARCH \
222225
--host=$ARCH \
226+
--with-default-msvcrt=msvcrt-os \
223227
--disable-dependency-tracking \
224228
--disable-lib32 \
225229
--enable-lib64 \

src/variant-i686.patch

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,39 @@
55
-ARG ARCH=x86_64-w64-mingw32
66
+ARG ARCH=i686-w64-mingw32
77

8-
@@ -92,2 +92,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
9-
--host=$ARCH \
8+
@@ -93,2 +93,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
9+
--with-default-msvcrt=msvcrt-os \
1010
+ --with-default-win32-winnt=0x0501 \
1111
&& make -j$(nproc) \
12-
@@ -98,2 +99,5 @@ RUN ln -s $ARCH mingw
12+
@@ -99,2 +100,5 @@ RUN ln -s $ARCH mingw
1313

1414
+# Disable UTF-8 manifest for Windows XP (#58)
1515
+RUN echo >/gcc-$GCC_VERSION/gcc/config/i386/winnt-utf8.manifest
1616
+
1717
WORKDIR /x-gcc
18-
@@ -103,2 +107,3 @@ RUN /gcc-$GCC_VERSION/configure \
18+
@@ -104,2 +108,3 @@ RUN /gcc-$GCC_VERSION/configure \
1919
--target=$ARCH \
2020
+ --with-arch=pentium4 \
2121
--enable-static \
22-
@@ -130,4 +135,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
22+
@@ -132,4 +137,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
2323
--disable-dependency-tracking \
2424
- --disable-lib32 \
2525
- --enable-lib64 \
2626
+ --enable-lib32 \
2727
+ --disable-lib64 \
2828
CFLAGS="-Os" \
29-
@@ -214,2 +219,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
30-
--host=$ARCH \
29+
@@ -217,2 +222,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-headers/configure \
30+
--with-default-msvcrt=msvcrt-os \
3131
+ --with-default-win32-winnt=0x0501 \
3232
&& make -j$(nproc) \
33-
@@ -223,4 +229,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
33+
@@ -227,4 +233,4 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-crt/configure \
3434
--disable-dependency-tracking \
3535
- --disable-lib32 \
3636
- --enable-lib64 \
3737
+ --enable-lib32 \
3838
+ --disable-lib64 \
3939
CFLAGS="-Os" \
40-
@@ -249,2 +255,3 @@ RUN /gcc-$GCC_VERSION/configure \
40+
@@ -239,2 +245,3 @@ RUN /mingw-w64-v$MINGW_VERSION/mingw-w64-libraries/winpthreads/configure \
4141
--host=$ARCH \
4242
+ --with-arch=pentium4 \
4343
--enable-static \

0 commit comments

Comments
 (0)