-
Notifications
You must be signed in to change notification settings - Fork 13k
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
RFC: Provide only std
for windows-gnu
and not rustc
#41165
Comments
Nominated since this seems like an important change to the rust release / deployment process. |
Wouldn't this break compiler plugins? (Including procedural macros, unless and until those move into separate processes.) Rust code compiled for windows-gnu can't link with compiler libraries compiled for windows-msvc. |
Compiler plugins work today while cross compiling, so they should continue to work, shouldn't they? (Unless the compiler plugin can only be compiled with |
Good point, I missed that because I didn't think of this as cross compiling. However, when cross compiling, you normally have a full host tool chain. For this proposal that would mean you'd need Visual Studio installed to compile windows-gnu crates which transitively use plugins (which more and more crates will, now that custom derive is stable). That amounts to eliminating windows-gnu as a host platform and demoting it to a cross compilation target. I'm not sure if that's acceptable. |
Indeed, I hadn't thought of that. This does make my proposal significantly less appealing. |
Unfortunately while I would very much enjoy implementing such a proposal I don't think that it's possible. As @rkruppe brought up plugins (and also build scripts) will throw a wrench into this. Cargo currently assumes that if it doesn't pass Finally, Cargo also deduplicates compilations as much as possible. If you've got a build script that depends on crate foo, and then your library also depends on crate foo, then the crate foo will only be compiled once if you omit the Unfortunately all of these are incompatible (I think at least) with a compiler that produces a different target by default. Let's say we have a MSVC host compiler with a MinGW target.
I fear that our only recourse here is to simply deprecate the MinGW host compiler. This would be a serious blow to usability, however, as you've discovered because that means that to be productive in Rust you'll need a Visual Studio installation no matter what. Now I think an argument can be made that you should have Visual Studio regardless. It really does seem like we're going in the direction of making MinGW purely a cross-compiled target, not a hosted target. We simply do not have a choice if LLVM does not compile. |
The primary missing alternative - make sure LLVM compiles on MinGW (with posix threads if needed), communicate to LLVM devs that MinGW is important, send patches if necessary. |
My PR #40805 allows building rust with "pthreads" mingw-w64, including the one packaged by msys. |
If we made compiler plugins into |
@retep998 That would probably work for current custom derives, but it becomes increasingly unworkable as the proc_macro API surface increases. After a certain point not too far away from the current state, it would be easier to just make it a whole separate process and communicate via IPC, as has been proposed before. What's worse, it's entirely impractical for other kinds of plugins (e.g., lints like clippy) which directly interact with large portions of rustc internals. |
Thanks for all the comments. It seems like this is not something we want to do at this time, so I'm gonna close this for now. Out of curiosity, would a functional |
@TimNN As I've said before we need 1. the linker 2. the CRT and 3. the windows SDK. A functional |
@retep998: Thanks for the explanation! |
MSYS2 have few not critical LLVM 4.0 patches (0001-0007) but they are enough to let it work fine: https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-clang As it was mentioned earlier MinGW GCC/Clang and MSVC produce ABI incompatible libs so mixing is impossible. BTW lld is still mostly unusable for MinGW hosts. |
Motivation: Compiling LLVM with MinGW is a huge PITA and for LLVM 4.0 would likely require us to switch to "MinGW with Posix Threads" from "MinGW with Win32 Threads".
As far as I know, there should be no reason why an enduser would require
rustc
to be available compiled by MinGW (Edit: as pointed out below, unless they have a compiler plugin which requireswindows-gnu
).Such a change would likely require modifications to any or multiple of
rustc
,rustup
andrustbuild
, depending on the approach taken.Another benefit: This would probably get rid of 95% of spurious appveyor failures.
cc @alexcrichton, @retep998, @rust-lang/tools
The text was updated successfully, but these errors were encountered: