Hi.
I spent last week getting Rust to work with Visual Studio 2017. In the
process I learned a few things that crate authors need to know in
order to ensure VS2017 compatibility. Here they are.
TL;DR:
-
rustc 1.19.0-nightly (0418fa9d3 2017-06-04)
should work correctly
with VS 2017 without running vcvars.bat. Sadly, it's now busted
against gnu toolchains, but that should be fixed soon. - Upgrade gcc-rs deps to 0.3.50
- Upgrade cmake deps to 0.1.24
- Upgrade lzma-sys to 0.1.6
In VS 2017 the scheme for locating the MSVC compiler changed again, so
I updated the gcc crate (which is actually the general C compiler
driver crate) to do that detection, based on work by @retep998, and
then updated rustc itself to use the gcc crate instead of its own
logic.
Similarly, I replaced some detection logic in cmake-rs to defer again
to gcc-rs, making gcc-rs the source of truth globally for locating
MSVC.
And in the process I discovered that lzma-sys was reporting the wrong
"platform toolset" version to msbuild (it should be "v141"), and
upgraded that.
At this point, cargo, rls, and rustup all appear to build correctly
under VS 2017. So please give it a try and see if it works for you.
References:
- Rust VS2017 issue
- rustup VS2017 issue
- new -gnu bustage
- gcc-rs patches 1 2 3 4 5. Sloppy work...
- cmake-rs patch
- lzma-sys patch