Stream: t-compiler

Topic: [WIP] Fixing MinGW link errors #47048


mati865 (Dec 13 2019 at 19:29, on Zulip):

Before you burn me at the stake for using static mut. It's a shortcut that is not going to end up even in draft PR.
I have committed first of the fix at https://github.com/rust-lang/rust/commit/d87b0043778b83063b7e431c63bb1cf47bcbdac9
It might be easier to understand if you look at the linker invocation first: https://www.diffchecker.com/GEuYFmzo
Original invocation fails when linking together Rust and C objects because Rust ships mingw-w64 libraries that almost never happen to be compatible with user's mingw-w64 installation.
My changes get system mingw-w64 libraries path and caches it (lines 905-933), libraries that are passed to the linker via their full path (crt2.o in this case) are first searched in system mingw-w64 installation (lines 936-944) and finally it prepends system mingw-w64 libraries search path before rust libraries (lines 1118-1123).
IMO the idea is good (code isn't) and I'd like to hear from the team about it.
Note: Because of #[cfg(...)] it works only on Windows but the same workaround is required when cross-compiling.

mati865 (Dec 13 2019 at 19:30, on Zulip):

Sorry for the wall of text.

mati865 (Dec 19 2019 at 16:36, on Zulip):

Opened https://github.com/rust-lang/rust/pull/67429

mati865 (Dec 27 2019 at 09:48, on Zulip):

Can somebody do @bors try on https://github.com/rust-lang/rust/pull/67429 ?

Last update: May 26 2020 at 11:05UTC