Skip to content

Set requirements for windows-gnu #993

@mati865

Description

@mati865

Proposal

Currently, there are no declared minimal versions for tools used with windows-gnu targets. When somebody has problem with their old tooling, it's usually recommended to try with what Rust uses on the CI, which is nontrivial to figure out (FYI, it's https://github.com/niXman/mingw-builds-binaries/releases/tag/14.1.0-rt_v12-rev0). This translates to:

  • GCC 14.1.0
  • Binutils 2.42
  • mingw-w64 12.0.0

Settling on the minimal versions for the tools will be hard because there are numbers of recent fixes that would benefit Rust, so I'll list notable fixes and corresponding Binutils version which is the most important component to us (because it's the most troublesome):

Versioning of other components isn't as much important to Rust:

  • mingw-w64 provides headers, libs and objects enabling use of Windows built-in libraries, so you typically want to always use latest version (many toolchains use latest trunk); with raw-dylib this has become much less important
  • GCC provides unwind library and C/C++ compiler, we'd be fine with whatever can build our dependencies like LLVM

Toolchains available in the open:

Details

  • MSYS2 (Windows native):
    • GCC 16.1
    • Binutils 2.46
    • mingw-w64 trunk
  • mingw-w64-builds (Windows native):
    • GCC 16.1
    • Binutils 2.46
    • mingw-w64 14.0.0
  • w64devkit (Windows native):
    • GCC 16.1
    • Binutils 2.46
    • mingw-w64 14.0.0
  • Arch Linux:
    • GCC 16.1
    • Binutils 2.46
    • mingw-w64 14.0.0
  • Debian stable:
    • GCC 14.2
    • Binutils 2.43.1
    • mingw-w64 12.0.0
  • Debian testing/unstable:
    • GCC 15.2
    • Binutils 2.45
    • mingw-w64 14.0.0
  • Fedora 42:
    • GCC 14.2
    • Binutils 2.43.1
    • mingw-w64 12.0.0
  • Fedora 43:
    • GCC 15.2
    • Binutils 2.45.1
    • mingw-w64 13.0.0
  • Fedora 44:
    • GCC 16.1
    • Binutils 2.46
    • mingw-w64 13.0.0
  • Ubuntu 24.04 LTS:
    • GCC 13.2
    • Binutils 2.41
    • mingw-w64 11.0.1
  • Ubuntu 26.04 LTS:
    • GCC 13.2
    • Binutils 2.45
    • mingw-w64 13.0.0
  • cross-rs
    • GCC 9.3/9.4 (x86_64/i686)
    • Binutils 2.34
    • mingw-w64 7.0.0

I hope that we can figure out in the discussion (using a poll?) which version should we make as the baseline. Personally I'd like if we could make it Binutils 2.44 and enable native TLS (as a subsequent work), but this might be a hot take.

Additional thing to consider

Since mingw-w64 12.0.0, UCRT is the default CRT library, but the distributions tend to conservatively keep MSVCRT as the default (except Arch Linux), and provide UCRT as a separate package. UCRT is recommended by MSYS2 and more popular choice at mingw-w64-builds when comparing download counts.
If'd feel like a missed opportunity if we went with this MCP and remained stuck at MSVCRT.

How it works?

Mingw-w64 provides three libs:

  • libmsvcrt-os.a - Windows MSVCRT import lib
  • libucrt.a - Windows UCRT import lib
  • libmsvcrt.a - UCRT with mingw-w64 12, unless configured otherwise

GCC, Clang and rustc all link the CRT via -lmsvcrt, so the binary will use whatever the toolchain uses by default. There is a caveat however, mixing different CRTs is nontrivial and should be avoided unless use knows what they're doing.
While Rust's artifacts so far work with both MSVCRT and UCRT toolchains, making UCRT the default one could save us headaches in the future.

Mentors or Reviewers

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member who is knowledgeable in the area can second by writing @rustbot second or kickoff a team FCP with @rfcbot fcp $RESOLUTION.
  • Once an MCP is seconded, the Final Comment Period begins.
    • Final Comment Period lasts for 10 days after all outstanding concerns are solved.
    • Outstanding concerns will block the Final Comment Period from finishing. Once all concerns are resolved, the 10 day countdown is restarted.
    • If no concerns are raised after 10 days since the resolution of the last outstanding concern, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Caution

Concerns (1 active)

Managed by @rustbot—see help for details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerAdd this label so rfcbot knows to poll the compiler teamfinal-comment-periodThe FCP has started, most (if not all) team members are in agreementhas-concernsThere are active concernsmajor-changeA proposal to make a major change to rustcto-announceAnnounce this issue on triage meeting

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions