Skip to content

windows-gnu: prefer system crt libraries if they are available#67429

Merged
bors merged 1 commit intorust-lang:masterfrom
mati865:mingw-ultimate-fix
Feb 5, 2020
Merged

windows-gnu: prefer system crt libraries if they are available#67429
bors merged 1 commit intorust-lang:masterfrom
mati865:mingw-ultimate-fix

Conversation

@mati865
Copy link
Copy Markdown
Member

@mati865 mati865 commented Dec 19, 2019

The origin of the issue is the fact Rust ships mingw-w64 libraries but no headers and prefers own libraries over the system ones.
This leads to situation when headers aren't compatible with libraries (mingw-w64 doesn't provide any forward compatibility and AFAIK backwards compatibility is guaranteed only within major release series).

It's easier to understand how this PR works when looking at the linker invocation before and with this PR: https://www.diffchecker.com/GEuYFmzo
It adds system libraries path before Rust libraries so the linker will prefer them.
It has potential issue when system has files with the same names as Rust but that could be avoided by moving Rust shipped mingw-w64 libraries from lib/rustlib/x86_64-pc-windows-gnu/lib to say lib/rustlib/x86_64-pc-windows-gnu/lib/mingw. Then adding linker paths in this order: Rust libraries, system libraries, Rust shipped mingw-w64 libraries.

Fixes #47048
Fixes #49078
Fixes #53454
Fixes #60912

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linkage Area: linking into static, shared libraries and binaries merged-by-bors This PR was explicitly merged by bors. O-windows-gnu Toolchain: GNU, Operating system: Windows S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet