rust-lang / rust-lang/rust

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

Open
#152,720 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-driver C-bug O-windows-gnu T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the Windows-target checks in compiler/rustc/build.rs, compiler/rustc_driver/build.rs, and src/tools/cargo/build.rs with compiler/rustc_windows_rc/src/lib.rs. Examine the provided windres commands and verify that a MinGW-w64 build links the generated resource object so the resulting executables contain the long-path manifest.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.