-
Notifications
You must be signed in to change notification settings - Fork 455
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
Visual Studio 2017 #143
Comments
@retep998 was talking about this on #rust-internals not long ago, apparently Microsoft changed things again so the registry method doesn't work. The officially supported way to locate the MSVC 2017 install is by calling a bunch of COM APIs. There's a Microsoft blog post with more information. |
I have VS 2017 code in https://github.com/retep998/msvc-bunny. Once it gets support for detecting all msvc versions with an actual API and has a proper name, gcc can be switched to using it. |
Awesome, thanks @retep998! Is there anything I can do to help that out? |
@alexcrichton The biggest struggle with that crate is not the functionality itself, but figuring out how to emit warnings and diagnostics to the user regarding their msvc installation (or lack of one). Help in designing the API would be appreciated. |
@retep998 Wouldn't warnings/diagnostics be part of how the compiler and/or gcc consume this API? That is, not so much an API question or library question for the crate you're working on? It looks like right now the bindings are mostly the raw COM api methods and whatnot, is that right? If so that seems reasonable to me but did you have specific other aspects you were up in the air about? |
@alexcrichton Basically, I want rustc to be able to print out various diagnostics such as "Successfully located VC++ 14 but failed to locate a valid installation of the Windows SDK", or "No VC++ installation found. The only link.exe in your PATH is from MinGW which will now fail". Basically the question is how should the crate expose this information so consumers like rustc and gcc and rustup can print out these relevant diagnostics. |
Hm ok. I suspect detection of previous installations won't be changing, right? In that sense all the code is already written (what's in the compiler/gcc-rs right now), I think? In that sense is this just a question of how to do this for Visual Studio 2017? |
@alexcrichton I'd like to do these advanced diagnostics for all versions. The actual logic of finding installations is already written in rustc and gcc and can be copied over with a bit of modification, but how to report failure is something I really want to improve on across the board. |
Oh I just figured there'd be a customized routine for basically every VS version known. That way when you want to find a VS version you just attempt to find all of them, returning an error if all of them return an error or success if any of them succeed? |
The vswhere utility provide this functionality. I don't see why rust core tools couldn't package it and redist it, at least on Windows; the MIT license is fairly permissive. |
@whoisj The kind of problem I'm trying to solve is "What do I do when the user only partially installed VC++ and is missing part of it, such as the Windows SDK?". If I just ask vswhere and it says nope, what am I going to tell the user? If I myself do all the hard work of finding VC++ then I know exactly why I failed to get a complete toolchain and I can tell the user. The hard part isn't finding VC++, it is reporting misconfigured environments to the user. |
@retep998 I agree, but the vswhere application already understands how to query for various SDKs published by Microsoft. Using it avoids attempting to duplicate and maintain functionality already provided by Microsoft. As you can see from the help spew, it'll filter data via the
Additionally, there's no reason it cannot be improved to find additional Microsoft SDKs not installed by Visual Studio. |
@whoisj Have you actually looked at the data that In fact, for VS 2015 and older rustc doesn't actually care where VS is. The closest thing it does do is find where VC is (https://github.com/rust-lang/rust/blob/master/src/librustc_trans/back/msvc/mod.rs#L179-L184), and beyond that the rest of the code there cannot be replaced by shelling out to |
This teaches gcc-rs to find tools installed by MSVC 2017. It's not obvious to what extend the new COM interfaces are expected to be use. This patch only uses it to find the product installation directory, then infers everything else. A lot of COM scaffolding to do very little. The toolchains seem to have a different directory structure in this release to better support cross-compilation. It looks to me like all the lib/include logic is pretty much the same as it always has been. This is tested to fix the rustup installation logic, and to fix rustc in basic use cases on x86_64. cc rust-lang#143 cc rust-lang/rustup#1003 cc rust-lang/rust#38584
@retep998 agreed about that. And the COM spaghetti likely isn't necessary, as all the location data you really need it contained in As for the uCrt and WinSdk locations - it is something we should likely provide via vswhere or similar tool. But fair point about limited information provided by the vswhere application. |
This teaches gcc-rs to find tools installed by MSVC 2017. It's not obvious to what extend the new COM interfaces are expected to be use. This patch only uses it to find the product installation directory, then infers everything else. A lot of COM scaffolding to do very little. The toolchains seem to have a different directory structure in this release to better support cross-compilation. It looks to me like all the lib/include logic is pretty much the same as it always has been. This is tested to fix the rustup installation logic, and to fix rustc in basic use cases on x86_64. cc rust-lang#143 cc rust-lang/rustup#1003 cc rust-lang/rust#38584
This teaches gcc-rs to find tools installed by MSVC 2017. It's not obvious to what extend the new COM interfaces are expected to be use. This patch only uses it to find the product installation directory, then infers everything else. A lot of COM scaffolding to do very little. The toolchains seem to have a different directory structure in this release to better support cross-compilation. It looks to me like all the lib/include logic is pretty much the same as it always has been. This is tested to fix the rustup installation logic, and to fix rustc in basic use cases on x86_64. cc rust-lang#143 cc rust-lang/rustup#1003 cc rust-lang/rust#38584 cc alexcrichton/curl-rust#161
This teaches gcc-rs to find tools installed by MSVC 2017. It's not obvious to what extent the new COM interfaces are expected to be used. This patch only uses it to find the product installation directory, then infers everything else. A lot of COM scaffolding to do very little. The toolchains seem to have a different directory structure in this release to better support cross-compilation. It looks to me like all the lib/include logic is pretty much the same as it always has been. This is tested to fix the rustup installation logic, and to fix rustc in basic use cases on x86_64. cc rust-lang#143 cc rust-lang/rustup#1003 cc rust-lang/rust#38584 cc alexcrichton/curl-rust#161
This teaches gcc-rs to find tools installed by MSVC 2017. It's not obvious to what extent the new COM interfaces are expected to be used. This patch only uses it to find the product installation directory, then infers everything else. A lot of COM scaffolding to do very little. The toolchains seem to have a different directory structure in this release to better support cross-compilation. It looks to me like all the lib/include logic is pretty much the same as it always has been. This is tested to fix the rustup installation logic, and to fix rustc in basic use cases on x86_64. cc rust-lang#143 cc rust-lang/rustup#1003 cc rust-lang/rust#38584 cc alexcrichton/curl-rust#161
In theory closed by #160, but if there's futures issues please feel free to comment here or open a new issue! |
This teaches gcc-rs to find tools installed by MSVC 2017. It's not obvious to what extent the new COM interfaces are expected to be used. This patch only uses it to find the product installation directory, then infers everything else. A lot of COM scaffolding to do very little. The toolchains seem to have a different directory structure in this release to better support cross-compilation. It looks to me like all the lib/include logic is pretty much the same as it always has been. This is tested to fix the rustup installation logic, and to fix rustc in basic use cases on x86_64. cc rust-lang#143 cc rust-lang/rustup#1003 cc rust-lang/rust#38584 cc alexcrichton/curl-rust#161
https://github.com/alexcrichton/gcc-rs/blob/master/src/windows_registry.rs#L120 needs to be updated to look for whatever the version number for VS2017 is (16.0?)
The text was updated successfully, but these errors were encountered: