On Thu, 20 Jul 2023, Thiago Macieira wrote:
On Thursday, 20 July 2023 06:14:24 PDT Martin Storsjö wrote:
So are you saying that you're building your app with a non-default CRT
selected with the -mcrtdll option?
Yes.
If you use the GCC -mcrtdll option for picking a non-default CRT, it would
work unless you're also linking, even statically, a toolchain-provided
libstdc++ though. I'm pretty sure that at least some parts of libstdc++
touch things that have a differing ABI, even if most things might seem to
work.
We build our own GCC (after applying that patch), but I haven't checked
whether it used UCRT for cross-building libstdc++. Ideally we wouldn't need a
-mcrtdll option, but enforce it directly in the compiler.
Right - if you're already building GCC, you're actually in a great
position to set things up properly. If you build a new sysroot for this
GCC at the same time, it should be fairly straightforward to switch the
CRT for this.
After building the compiler part of the new GCC (make install-gcc) you can
set up the mingw-w64 headers/crt for this new toolchain - here you can
configure both with --with-default-msvcrt=ucrt; after this you can finish
building the rest of GCC's runtimes with this new sysroot, and everything
will be built consistently with the new CRT. GCC itself will be linked
against the CRT choice of your original toolchain, but whatever it
produces will use the new one.
At https://martin.st/temp/gcc-mingw.docker I've got an example of such a
bootstrap procedure. That's for starting out on Linux, building a cross
compiler, and then using that to cross compile GCC for Windows. But if
you're already on windows, it should be enough with the gcc/install-gcc +
mingw-w64-headers + mingw-w64-crt + gcc/install steps.
// Martin
--
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development