rust-osdev / cargo-xbuild

Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc.
Apache License 2.0
256 stars 25 forks source link

xbuild on Windows with git bash using gnu linker when msvc linker unavailable #85

Open Neben5 opened 3 years ago

Neben5 commented 3 years ago

Recently, I accidentally uninstalled MSVC tooling on my windows machine unknowingly. This removed the MSVC linker, which (I believe) xbuild normally tries to use. Because I am using git bash, there is an included linker in the shell, which was used instead, and made builds fail. Untitled-1.txt This massive error message is what resulted. It was extremely hard to find out what was wrong, and I ended up having to reinstall xbuild, rust, all my toolchains, etc. Would it be possible to add some sort of check to ensure that the user knows the issue? This massive linker error dump is not useful at all.

phil-opp commented 3 years ago

This sounds more like an issue in rustc/cargo itself, than related to cargo-xbuild. We only invoke cargo for the sysroot build, nothing else. So if the wrong linker is used, it is invoked directly from cargo/rustc.

I would recommend looking through the rust/cargo issues to see whether it was already reported, and open a new issue there otherwise. From a quick search, maybe these threads are related: https://github.com/rust-lang/rust/issues/43069, https://github.com/rust-lang/rust/pull/72296