From Fedora Project Wiki

Revision as of 14:18, 16 February 2022 by Bcotton (talk | contribs) (Change approved by FESCo)

MinGW UCRT target

Summary

This proposal is to add the UCRT target & support from Fedora to the MinGW cross-toolchains.

Owner


Current status

  • Targeted release: Fedora Linux 37
  • Last updated: 2022-02-16
  • devel thread
  • FESCo issue: #2754
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

The current mingw32 and mingw64 cross-toolchains provided by Fedora target the MSVCRT (Microsoft Visual C++ Runtime). Since Visual Studio 15 & Windows 10, the default and recommended runtime is UCRT. See also MSVCRT vs UCRT.

A new toolchain target triple x86_64-w64-mingw32ucrt and associated binaries will be added.

Fedora MinGW macros will be provided to target UCRT, with ucrt64-* prefix (ex: ucrt64-meson)

mingw-* libraries will be progressively adjusted to add the produced ucrt64-* binaries.

Since mingw-*.spec are very repetitive and cumbersome to modify (each mingw32, mingw64, ucrt package has to be defined manually, and this is tedious and error-prone), a custom MinGW/Fedora tool or solution will be proposed. In the meantime, packages can be modified to add manually the new target.

UCRT plans on mingw@lists.fedoraproject.org

Feedback

Benefit to Fedora

This change will allow to cross-compile projects to Windows with the up to date C runtime & headers, and better c99 support. This should allow to more easily mix binaries produced from different versions or compilers as well.

Scope

  • Proposal owners:
    • update the mingw filesystem, binutils, headers, gcc & winpthreads packages
    • bootstrap the new toolchain
    • propose a solution to simplify library packaging with the different targets
    • update some common library packages, such as mingw-zlib
  • Other developers:
    • Progressively adjust the mingw-* packages to produce ucrt64- packages, following the updated guidelines.
  • Policies and guidelines: N/A (not needed for this Change)

https://fedoraproject.org/wiki/Packaging:MinGW packaging guideline will be adjusted.

  • Trademark approval: N/A (not needed for this Change)
  • Alignment with Objectives:


Upgrade/compatibility impact

None

How To Test

$ x86_64-w64-mingw32ucrt-gcc test.c

$ /usr/bin/mingw-objdump -p a.exe | grep DLL
 vma:            Hint    Time      Forward  DLL       First
    DLL Name: KERNEL32.dll
    DLL Name: api-ms-win-crt-time-l1-1-0.dll
    DLL Name: api-ms-win-crt-math-l1-1-0.dll
    DLL Name: api-ms-win-crt-runtime-l1-1-0.dll
    DLL Name: api-ms-win-crt-environment-l1-1-0.dll
    DLL Name: api-ms-win-crt-private-l1-1-0.dll
    DLL Name: api-ms-win-crt-heap-l1-1-0.dll
    DLL Name: api-ms-win-crt-locale-l1-1-0.dll
    DLL Name: api-ms-win-crt-stdio-l1-1-0.dll
    DLL Name: api-ms-win-crt-string-l1-1-0.dll


User Experience

Windows binaries produced by Fedora cross-toolchain will target a more modern and compatible C runtime, bringing hopefully better compatibility & safety.

Dependencies

None

Contingency Plan

  • Contingency mechanism: N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? No (not a System Wide Change)

Documentation

N/A (not a System Wide Change)

Release Notes

The new MinGW toolchain and tools are available to compile binaries targeting the Windows UCRT.