#1142993 g++-mingw-w64-ucrt64: ucrt build fails to default to ucrtbase

Package:
g++-mingw-w64-ucrt64
Source:
g++-mingw-w64-ucrt64
Description:
GNU C++ compiler for MinGW-w64 targeting UCRT Win64
Submitter:
Cliff Kilby
Date:
2026-07-29 12:47:03 UTC
Severity:
normal
#1142993#5
Date:
2026-07-29 12:46:06 UTC
From:
To:
Dear Maintainer,

Given a trivial main.cxx:
#include <windows.h>
int main(int argc, char **argv)
{
return 0;
}
Compilation using ucrt g++ defaults to the wrong crt.
(-plugin-opt=-pass-through=-lmsvcrt below)

x86_64-w64-mingw32ucrt-g++ -v main.cxx -o main.exe

COLLECT_GCC_OPTIONS='-v' '-o' 'main.exe' '-shared-libgcc' '-mtune=generic'
'-march=x86-64' '-dumpdir' 'main.'
 /usr/lib/gcc/x86_64-w64-mingw32ucrt/15/collect2 -plugin
/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/lto-wrapper
-plugin-opt=-fresolution=/t
mp/ccIMKscQ.res -plugin-opt=-pass-through=-lmingw32
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt
-plugin-opt=-p
ass-through=-lkernel32 -plugin-opt=-pass-through=-lpthread
-plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32
-plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32
 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmingwex
-plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lk
ernel32 -m i386pep -Bdynamic -o main.exe
/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/../../../../x86_64-w64-mingw32ucrt/lib/crt2.o
/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/crtbegin.o
-L/usr/lib/gcc/x86_64-w64-m
ingw32ucrt/15
-L/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/../../../../x86_64-w64-mingw32ucrt/lib
/tmp/ccpCzx7f.o -lstdc++ -lmingw32 -lgcc_s -lgcc -lmingwex -lmsvcrt
-lkernel32 -lpthread -ladvapi32 -lshell32
 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmingwex -lmsvcrt -lkernel32
/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/crtend.o


Workaround available that forces what I would have considered to be the
correct default behavior. (-plugin-opt=-pass-through=-lucrtbase below)

x86_64-w64-mingw32ucrt-g++ -v main.cxx -o main.exe -mcrtdll=ucrtbase

COLLECT_GCC_OPTIONS='-v' '-o' 'main.exe' '-mcrtdll=ucrtbase'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'main.'
 /usr/lib/gcc/x86_64-w64-mingw32ucrt/15/collect2 -plugin
/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/lto-wrapper
-plugin-opt=-fresolution=/t
mp/ccxEOLp0.res -plugin-opt=-pass-through=-lmingw32
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lucrtbase
-plugin-opt=
-pass-through=-lkernel32 -plugin-opt=-pass-through=-lpthread
-plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32
-plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel
32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmingwex
-plugin-opt=-pass-through=-lucrtbase -plugin-opt=-pass-through
=-lkernel32 -m i386pep -Bdynamic -o main.exe
/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/../../../../x86_64-w64-mingw32ucrt/lib/crt2.o
/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/crtbegin.o -L/usr/lib/gcc/x86_64-w
64-mingw32ucrt/15
-L/usr/lib/gcc/x86_64-w64-mingw32ucrt/15/../../../../x86_64-w64-mingw32ucrt/lib
/tmp/ccI4fIwx.o -lstdc++ -lmingw32 -lgcc_s -lgcc -lmingwex -lucrtbase
-lkernel32 -lpthread -ladvapi32 -ls
hell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmingwex -lucrtbase
-lkernel32 /usr/lib/gcc/x86_64-w64-mingw32ucrt/15/crtend.o
COLLECT_GCC_OPTIONS='-v' '-o' 'main.exe' '-mcrtdll=ucrtbase'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'main.'