-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Rustbuild requires vcvars for windows msvc #34576
Comments
The relevant function for detecting the visual studio generator is located here, and it's pretty simple in terms of trying to detect what it should pass. Perhaps there's a better method of determining what the cmake generator should be? This may also be a case where it's only broken on some installations (perhaps more recent ones?) rather than older ones. |
I think the problem might be that // TODO: need a better way of scraping the VS install... |
One thing that may be helpful to resolve this is some more information about your local setup as well. For example what path is returned that cmake-rs is taking a look at? What's the correct generator for Visual Studio 2015 in this case? |
|
Hm so that is, if only Visual Studio 2015 is installed, then CMake can't actually generate build files? |
Well, 14.0 is VS 2015 which is fine, while 15.0 is the new preview version of Visual Studio which CMake doesn't support yet. |
Ok, so you're thinking that cmake-rs understand a list of generators, and it tries to find all installations as well. If any generator matches any installation, it'll do that, but otherwise it'll give an error? |
@alexcrichton Yes, I think that would be a superior solution to the current system. |
Unfortunately that suffers the problem of disagreement among tools of which version of Visual Studio to use. In that case gcc-rs might pick the highest version whereas cmake-rs would pick a lower version, and presumably the two are not interoperable, right? |
Statically linking code compiled with different versions of MSVC can cause issues, yes. So there'd have to be some way for everything to agree on which version of MSVC to use. Fortunately you can get around it by just invoking vcvars, although that doesn't work in cross compiling situations because either host code or target code would end up using the wrong linker. |
The invocation of vcvars is only needed for versions of Visual Studio that rustbuild or cmake doesn't understand, but if older versions are installed then there's no need to call vcvars. Closes rust-lang#34576
Clarify rustbuild + msvc + vcvars in README The invocation of vcvars is only needed for versions of Visual Studio that rustbuild or cmake doesn't understand, but if older versions are installed then there's no need to call vcvars. Closes #34576
Windows 10 64-bit with several versions of Visual Studio installed.
According to this comment by @alexcrichton, having to use vcvars to build Rust is a bug, so I have opened this issue.
The text was updated successfully, but these errors were encountered: