-
Notifications
You must be signed in to change notification settings - Fork 492
use -msvc variant on Windows #425
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
use -msvc variant on Windows #425
Conversation
Without an explicit list of targets, @io_bazel_rules_rust//rust/platform:x86_64-pc-windows-msvc is also included, and that is not currently supported by io_bazel_rules_rust. While this change fixes the build, it's probably best to wait for the outcome of bazelbuild/rules_rust#425, since if it changes there, a better solution would be to remove the -gnu variants from SUPPORTED_PLATFORM_TRIPLES in impl/src/bazel.rs
I experimented with enabling both -gnu and -msvc variants, and using a constraint setting to switch between them. This avoids the "Illegal ambiguous match on configurable attribute deps" errors that arise when both the -gnu variant and -msvc variant are listed in a crate's dependencies. I wasn't able to figure out how this could be made a default though, and if that's not possible, it means Windows users would need to define the environment they wish to use in their BUILD file, eg
and then specify the platform when compiling: bazel build //some:target --platforms=x86_64-windows-gnu --host_platform=x86-windows-gnu This is a bit of a pain, but then it's already necessary to pass -enable_runfiles in on Windows in order to get crate buildscripts to compile. Thoughts? |
I think commenting out the gnu version is preferable. |
Both the standard Rust installer, and rust_repositories() in this repo default to the -msvc platform. Since it is the default on Windows, this change comments out the -gnu variant instead. This change (along with some fixes in cargo raze) allows crates with msvc-specific build deps to compile. I do not know enough about Bazel to say if it will have any unintended side effects, but it seems to work for me.
5e9f1bc
to
f2b9a04
Compare
Sorry, I had thought I'd commented out the other set already - corrected. |
Thanks! |
It looks like |
I have a fix in #450 |
Just an FYI: bazelbuild/platforms#38 may potentially lead to support for both |
use -msvc variant on Windows
Both the standard Rust installer, and rust_repositories() in this repo
default to the -msvc platform. Since it is the default on Windows,
this change comments out the -gnu variant instead.
This change (along with some fixes in cargo raze) allows crates with
msvc-specific build deps to compile. I do not know enough about Bazel
to say if it will have any unintended side effects, but it seems to
work for me, and allows a moderate sized project with about 250
crate dependencies to compile using the default toolchain.