rustup
rustup copied to clipboard
Install rust-mingw component when adding a target
When adding the target i686-pc-windows-gnu
, rustup only installs rust-std, not rust-mingw. To cross-compile we need mingw component.
When manually downloaded and copied rust-mingw, compile works well.
Thanks for the report! This is interesting indeed. rust-mingw
is installed with the win/gnu toolchain but not with the rust-std
package.
The easy way to fix this would be to have rustup
hard-code an understanding that sometimes rust-std
depends on rust-mingw
, but I think to do it correctly we probably need to update the manifest format so that packages other than rust
can declare subcomponents. Then we make rust-mingw
a sub-component of rust-std
instead of a subcomponent of rust
. Not sure offhand how disruptive this change would be.
I also know that @alexcrichton has a desire to make rust-mingw
an optional package instead of a default package.
In the meantime, a workaround for the problem would be to add the rust component
subcommand for installing arbitrary components (this is needed for other purposes too). Then one could install rust-mingw
manually.
One issue here is that rust-mingw
is specific to both the host and target architectures - installing it with the windows-gnu target would solve the problem when compiling on windows, but wouldn't help with cross-compiling from linux to windows for example.
Logically, the rust-mingw
package sits in the same bracket as eg. the android SDK and other cross-linkers which rustc sometimes needs, it's just that for the moment we treat it specially.
@Diggsey I had to install mingw compiler, and add it as linker and ar in the cargo config. Then it worked well. I guess only the linker of rust-mingw
was architecture-dependent.
@Diggsey ah interesting observation. Yep.
Maybe we will deprecate the rust-mingw package and fold it into the NDK support feature of rustup when it arrives.
@rustbot label: +O-windows