rustup icon indicating copy to clipboard operation
rustup copied to clipboard

Install rust-mingw component when adding a target

Open bekker opened this issue 8 years ago • 6 comments

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.

bekker avatar Jul 21 '16 03:07 bekker

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.

brson avatar Jul 26 '16 01:07 brson

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 avatar Jul 28 '16 22:07 Diggsey

@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.

bekker avatar Jul 29 '16 02:07 bekker

@Diggsey ah interesting observation. Yep.

brson avatar Jul 29 '16 17:07 brson

Maybe we will deprecate the rust-mingw package and fold it into the NDK support feature of rustup when it arrives.

brson avatar Jul 29 '16 17:07 brson

@rustbot label: +O-windows

workingjubilee avatar Apr 29 '21 20:04 workingjubilee