-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with crt2.o and dllcrt2.o from mingw. #53454
Comments
* includes workaround for ongoing `gcc` library issues - see github:rust-lang/rust#47048 and github:rust-lang/rust#53454
* improves clarity and logging of the AppVeyor config * "install" is more generic and more easily usable within other rust crates * includes a fix/workaround for ongoing `gcc` library issues - see github:rust-lang/rust#47048 and github:rust-lang/rust#53454
* improves clarity and logging of the AppVeyor config * "install" is more generic and more easily usable within other rust crates * includes a fix/workaround for ongoing `gcc` library issues - see github:rust-lang/rust#47048 and github:rust-lang/rust#53454
* improves clarity and logging of the AppVeyor config * "install" is more generic and more easily usable within other rust crates * includes a fix/workaround for ongoing `gcc` library issues - see github:rust-lang/rust#47048 and github:rust-lang/rust#53454
* includes a fix/workaround for ongoing `gcc` library issues - see github:rust-lang/rust#47048 and github:rust-lang/rust#53454 - note: this fix is required for successful gcc/gnu compilation of `expr` on windows * improves clarity and logging of the AppVeyor config * "install" is more generic and more easily usable within other rust crates
* includes a fix/workaround for ongoing `gcc` library issues - see github:rust-lang/rust#47048 and github:rust-lang/rust#53454 - note: this fix is required for successful gcc/gnu compilation of `expr` on windows * improves clarity and logging of the AppVeyor config * "install" phase is more generic and more easily usable within other rust crates
* includes a fix/workaround for ongoing `gcc` library issues - see github:rust-lang/rust#47048 and github:rust-lang/rust#53454 - note: this fix is required for successful gcc/gnu compilation of `expr` on windows * improves clarity and logging of the AppVeyor config * "install" phase is more generic and more easily usable within other rust crates
Could we always use the crt2.o from the host toolchain? We can get the path by invoking |
That was my idea about solving it but couldn't manage to make simple fix. Edit: nowadays also msvcrt.a and mingwex.a also cause issues and the list will grow since Rust shipped libs become more out of sync from mingw-w64 headers installed on the system. |
windows-gnu: prefer system crt libraries if they are available This is my proposal (based on `Amanieu`'s idea) on how to fix #47048 and related issues. 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. I don't know if it's worth to cache system libraries path. You can look for `cache: ` string during build Rust: https://pastebin.com/kGEQZGWP I think there are enough calls to justify caching. Fixes #47048 Fixes #49078 Fixes #53454 Fixes #60912
All the referenced issues have been closed: rust-lang/rust#47048 rust-lang/rust#53454 rust-lang/cargo#6754 Since we can (and should) use 'stable' on these targets too, we don't need the TOOLCHAIN logic any longer, so remove it.
All the referenced issues [1] have been Closed, so use "stable" for everything. Now `i686-w64-mingw32-gcc` fails with this instead error: linker `i686-w64-mingw32-gcc` not found so keep it disabled. There is probably a simple solution for this that is obvious to someone used to cross-compiling Rust programs on Windows... [1] rust-lang/rust#47048 rust-lang/rust#53454 rust-lang/cargo#6754
All the referenced issues [1] have been Closed, so use "stable" for everything. Now `i686-w64-mingw32-gcc` fails with this instead error: linker `i686-w64-mingw32-gcc` not found so keep it disabled. There is probably a simple solution for this that is obvious to someone used to cross-compiling Rust programs on Windows... [1] rust-lang/rust#47048 rust-lang/rust#53454 rust-lang/cargo#6754
Those crt2.o and dllcrt2.o files have to match the gcc.exe used. So for example when i use win-gnu target in a msvc toolchain, I'll install my own copy of MINGW, and it should provide gcc.exe and those .o files, and i shouldn't use the rust-provided one.
So I suggest:
The text was updated successfully, but these errors were encountered: