Skip to content

Windows builds with MinGW-w64 GCC not including manifest for long path support #152720

@brechtsanders

Description

@brechtsanders

I'm trying to build the Rust compiler (currently 1.93.1) for Windows using MinGW-w64 + GCC and none of the MSVC tools.

For now I'm still allowing the bootstrap to use LLVM, as I didn't get it working et with GCC.

This resulted in a working build, except for one issue: the Manifest file specifying long path support was not included in the resulting .exe file(s).

Looking at files like:

  • compiler/rustc/build.rs
  • compiler/rustc_driver/build.rs
  • src/tools/cargo/build.rs

I see code like:

if Ok("windows") == target_os.as_deref() && Ok("msvc") == target_env.as_deref() {

which means MinGW-w64 is not considered on the Windows platform.

For MinGW-w64 the resource compiler is windres and it has different command line arguments than MSVC's rc.
This probably requires some changes in compiler/rustc_windows_rc/src/lib.rs.

For your reference, an example on how to get the manifest in the .exe file could look like this:

cat > "compiler/rustc/Windows Manifest.rc" << EOF
#include <windows.h>
1 RT_MANIFEST "Windows Manifest.xml"
2 ICON "../../src/etc/installer/gfx/rust-logo.ico"
EOF
windres "compiler/rustc/Windows Manifest.rc" -O coff -o "compiler/rustc/Windows Manifest.o"

if the .o file is the linked into the .exe file it should contain the manifest (and the icon in this example).

Is anybody working on this, or can you make some suggestions on what is needed to get this working?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-driverArea: rustc_driver that ties everything together into the `rustc` compilerC-bugCategory: This is a bug.O-windows-gnuToolchain: GNU, Operating system: WindowsT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions