Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uprustup does not recognize Visual C++ Build Tools #1003
Comments
This comment has been minimized.
This comment has been minimized.
|
Installing Visual Studio 2017 for C++ Desktop Development makes it work. Perhaps specifying installing VS with C++ is the safer bet. |
This comment has been minimized.
This comment has been minimized.
redstrike
commented
Mar 28, 2017
•
|
@projektir I got this issue. I have tested many custom installation settings of Visual C++ 2015 Build Tools installer. Install Visual C++ 2015 Build Tools with the DEFAULT installation will solve this problem Edit: rust requires Windows SDK (8.1 or 10 is ok). Another test: #1003 (comment) After that, I encountered this linker issue: rust-lang/rust#30319 I have tried to install "Visual Studio 2017 for C++ Desktop Development" as suggested, but it still not work, and rustup doesn't recognize Visual C++ Build Tools. Again, I have tested VS 2017 installer by adding more components related to C++ development, also try to strip as much as possible. Here is the required components to install Visual C++ via Visual Studio for Rust HelloWorld program: rustup still requires VC++ 2015 toolset, Universal CRT SDK & Windows 8.1 SDK to recognize the build tools. Therefore, I removed all VS 2017 related programs and re-install Visual C++ 2015 Build Tools with the DEFAULT settings for my Rust HelloWorld program. My linker issue is no longer happen anymore. I don't know why? Maybe, VS 2017's installation fixed it? I have tried to reproduce the linker problem by removing all and install again, but it has been disappeared. What a horrible getting started experience with Rust on Windows! |
This comment has been minimized.
This comment has been minimized.
|
@redstrike so happy to see that someone else ran into this! Thanks for describing this in such detail.
I very much had a similar approach that I think was causing issues. I kept trying to strip down what I was installing since I didn't really need much from VS on my machine. Among other things, I get a weird feeling that the Windows SDK is required (and you have it selected in your list), which just doesn't make much sense to me. I may experiment a bit more and see if I can confirm that. If we can figure out what exactly is needed for install, we could update the README.md. Seems like C++ 2015 Build Tools with DEFAULT settings (lol) is a good safe bet, but would also be nice to know how VS can be installed since many will have that on their machine. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@aturon I'm not quite sure what you have in mind, beyond changing the documentation, nor why you consider this particularly troubling? The fact is, rust currently requires (and has always required) all three of these components, and the components are installed by default when installing the VC++ build tools. If you remove those components it can't work. I can add a note the installation instructions saying to use the default settings, but anything more detailed, such as exactly which components are required, may be difficult to keep up to date and correct for all versions of the installer, since MS have a tendency to change things up quite a bit! Here's a breakdown of why each component is required:
@projektir @redstrike Is there something further you'd like to see changed? |
This comment has been minimized.
This comment has been minimized.
|
It doesn't really matter which VC++ toolset version you use, or which Universal CRT version you use, or which Windows SDK version you use as long as you have all three of them. However, it is generally better to have the newest versions when possible. If you install VC++ via VS 2017, then Rust is currently incapable of autodetecting this VC++ installation, and you'll have to manually configure your environment using a vcvars bat file or the VC++ development command prompt option. |
This comment has been minimized.
This comment has been minimized.
|
I was just about to jump in here to say
|
This comment has been minimized.
This comment has been minimized.
|
Here's the relevant issue for VS 2017 detection: rust-lang/rust#38584 |
This comment has been minimized.
This comment has been minimized.
redstrike
commented
Mar 28, 2017
•
|
@Diggsey Have more guide text is better than let the users sink themselves in unexpected issues and try to search for the solutions (It costs me a full afternoon to experiment with different installation settings). I had a great getting started with Golang in the past, I only need to run the official go1.8.windows-amd64.msi and it does the all the tedious tasks for me without relying on Visual Studio/C++ toolchain. Each time, I want to update my Go or Node version, just download the official installer and run... DONE. I don't have enough background in Computer Science, programming language & compiler design. But I think a modern system programming language like Rust should not rely on C++ build tools to compile & run HelloWorld program. I hope Rust could be that awesome and more beginner friendly. |
This comment has been minimized.
This comment has been minimized.
|
@redstrike I agree we should do more documentation-wise. I'm afraid what you're suggesting isn't really feasible for rust. Go avoids a dependency on a VC++ toolchain by implementing their own custom linker, which only works for go, and it comes with significant downsides. For example, as soon as you depend on a C library, you're back to needing a proper VC++ linker again. NodeJS isn't really comparable because javascript isn't a compiled language. However, if you use any npm libraries that have native dependencies, you'll again need the VC++ build tools. Basically. In the future, we may be able to automatically start the VC++ build tools installation if the user requests it, when rustup is initially installed, and I think that's as good as it's likely to get honestly. |
This comment has been minimized.
This comment has been minimized.
|
There seem to be several interrelated bugs here, and I'm not clear on them. There's the bug to teach rustc how to find the VC 2017 linker. That is not this bug. This is a bug about rustup-init not detecting a usable VC 2017 install. I'm not clear on why this is only a crisis now, when the VC 2017 bug in rustc has existed since 2016/12/31. Can anybody explain? (Maybe it only hit stable recently). Since rustc doesn't work correctly with some VC 2017's, doesn't that mean that even if rustup fixes its own detection, that rust will still be broken? Does anybody know what the necessary change to rustup is to make this detection work? How many versions of VS 2017 are there, and which ones work correctly with rustc, which ones don't work correctly with rustc, which ones work with rustup, which don't work with rustup? |
This comment has been minimized.
This comment has been minimized.
|
Getting Rust to not depend on a C++ toolchain is quite a long way in the future and would involve several things:
|
This comment has been minimized.
This comment has been minimized.
Because VS 2017 only had its actual stable release in March. Before then it was just previews and release candidates.
Unless you use vcvars to manually configure your environment, yes. Or if rustc delegates responsibility for detecting VC++ to rustup, which would involve the rustup proxies doing the autodetection and setting env vars appropriately before calling the actual binaries.
There is just the one VS 2017, and both rustc and rustup do not autodetect it currently. It can however have multiple VC++ toolsets installed and provides a COM api to select one of those toolsets which I am currently working with. |
This comment has been minimized.
This comment has been minimized.
|
Thanks @retep998. |
This comment has been minimized.
This comment has been minimized.
|
This discussion is getting a bit derailed. This is NOT about VS 2017. This is about rustup not detecting VC++ Build Tools (note the title). The VS 2017 thing just shines light on what's happening.
It is not at all obvious from the rustup installation page that you need, say, the Windows SDK. It just says VC++ toolset, which was installed, and present in the programs list, but not picked up by rustup. When you run rustup, it complains about the toolset.
This is true, and that's why I went for the VC++ Build Tools install at first. But it's also a very weird experience when your VC++ 2017 install, which Rust is incapable of detecting, fixes the issue by apparent side effect of installing extra missing components rustup didn't specify were needed (such as the Windows SDK). The problem I reported is with rustup not detecting the VC++ 2015 Build Tools, not VS 2017. It's completely understandable for rustup to not detect VS 2017. But it's a bad user experience when it tells you that VC++ 2015 Tools are OK, you install them, and it literally tells you they're not installed... when they're there... if it wants the SDK, it should say it wants the SDK. I hope that clears my complaint up. |
This comment has been minimized.
This comment has been minimized.
|
@projektir Ah, I think I see part of the confusion:
No, it says you need either (the VC++ build tools, which includes all three components), or (a full Visual Studio installation with the "C++ tools" option checked). I can see why it would be easy to misread that and believe that the "C++ tools" option applied to the former, but it only applies to the full visual studio option. Note that when you customize the installation and remove those components, you no longer have the VC++ build tools installed. The installer just happens to be modular - if you uncheck every component it will essentially install nothing, there's no "core" selection of required components.
But it is detecting them when they exist, you just don't have the "VC++ 2015 Build Tools" installed if you unchecked those components. Phrasing it as a detection problem is what started the confusion around VS 2017. |
This comment has been minimized.
This comment has been minimized.
That doesn't seem true according to Microsoft, because there's a minimum install size to the build tools (2 GB), and when I checked my programs list, it listed Microsoft Visual C++ Build Tools as installed. So while this may be true in some sense, it's not any kind of obvious sense. A given person may not be an expert on how rustup uses these tools, or how MS names their components, and shouldn't need to be. It's not infrequent for installers to come with a bunch of extra components a person may choose not to want to install for various reasons. I think a small update to the rustup page to say that you need all modules that come with the MS VC++ installer wouldn't hurt, and I'm perfectly willing to create a PR for that as long as everyone's OK with that. I would have made a PR straight away if I didn't think originally that this was a problem with rustup's detection, rather than semantic issues around what "VC++ Build Tools" actually means. |
This comment has been minimized.
This comment has been minimized.
|
Also, sorry to hammer this point further but I really think usability issues like this are very important to Rust's growth. Consider @redstrike comment here:
So if I'm understanding them correctly (I probably want to test this myself), regardless of which packages you choose, being in CUSTOM mode produces an installation rustup can't detect... that's definitely not something you can expect the average user to realize, I hope we can agree on that? |
This comment has been minimized.
This comment has been minimized.
|
So basically I need to split out all the VC++ detection logic into a separate crate which can provide diagnostics for why it failed to locate a suitable VC++ installation, including specific errors messages such as for when you have VC++ but not the Windows SDK. Then I need to make sure rustup, gcc, and rustc all get their detection logic from that crate.
I just remembered that this won't work because of cross compilation and build scripts. |
This comment has been minimized.
This comment has been minimized.
redstrike
commented
Mar 29, 2017
|
Let's reduce the scope from VS 2017 to this issue. In confusing mode yesterday, I may mismatch linker issue tests with rustup's recognization tests. So, I decided to reinstall VC++ 2015 Build Tools again to give you more information. rustup can recognize VC++ build tools in custom mode with Windows 8.1 SDK or Windows 10 SDK.Windows 10 SDK is bigger but requires fewer support packages than Windows 8.1 (Ex: VC++ 2013 Redist x86/x64). |
This comment has been minimized.
This comment has been minimized.
|
@redstrike So that confirms that there's nothing weird going on, and you just have to remember to select some Windows SDK version when installing the VC++ build tools. The initial fix for this is to expand the diagnostics and documentation to clarify that not only do you need the VC++ build tools, but you need to make sure you also get the Windows SDK with it. Later on we can then upgrade rustup to detect scenarios where VC++ was installed without the Windows SDK and emit a diagnostic telling the user of their mistake and how to fix it. |
This comment has been minimized.
This comment has been minimized.
redstrike
commented
Mar 29, 2017
•
|
@retep998 I have a concern about the linker. I could workaround this recognization issue with Default installation mode yesterday, but then I stuck at linker issue. Installing Visual Studio helped me solve this problem by accident. At the moment, although I removed all VS components, I cannot reproduce the above linker problem anymore, but it may haunt other users in the future. This means just install VC++ 2015 Build Tools is not enough. |
This comment has been minimized.
This comment has been minimized.
|
@redstrike Looks like you had a broken installation of the Windows 8.1 SDK. As you can see it is passing it via |
This comment has been minimized.
This comment has been minimized.
redstrike
commented
Mar 29, 2017
In a typical scenario, a beginner's Windows 10 machine usually doesn't have any installed Windows SDK. By default, Windows 8.1 SDK will be installed by VC++ 2015 Build Tools installer instead of Windows 10 SDK. So, if rustc could do sanity checks for Windows 8.1 SDK, it will be better than not. Helpful error messages with some troubleshoot tips are nice to have. By the way, I'm glad to know these kind of issues are still in your control |
This comment has been minimized.
This comment has been minimized.
kosinix
commented
Mar 31, 2017
|
This thread is long. But the most important question for us stuck on limbo in windows is: Is there any temporary "recommended" workaround ATM? Maybe post a Q/A on SO? Perhaps add some notes on rustup.rs website? Please. Just anything to get us going with msvc toolchain. |
This comment has been minimized.
This comment has been minimized.
|
@kosinix Just install the VC++ build tools with default options. Most of us on this thread are using windows with the MSVC toolchain, there's no real issue beyond better explaining what the dependencies are. |
This comment has been minimized.
This comment has been minimized.
kosinix
commented
Mar 31, 2017
|
@Diggsey I did. Im in similar situation with @redstrike. Windows 10 + vs studio 2017. As a last ditch effort, I uninstalled vs studio 2017 completely (which I tried to avoid since I spent a few days downloading it - third world country internet), uninstalled rustup, and installed vc build tools 2013. Didn't work. Iinstalled vc build tools 2015. Still getting this: Before this, I had no problems with windows 8.1 + rustup. It seems to be a win10 + vstudio 2017 issue. |
This comment has been minimized.
This comment has been minimized.
|
@kosinix This is not the issue for VS 2017 detection, please go here for that: rust-lang/rust#38584 |
This comment has been minimized.
This comment has been minimized.
|
Re: your issue with 2015 build tools, I haven't seen that issue before (assuming you installed with the default installation options), so I'm afraid I can't offer a workaround, but my best guess is that some remnant of the VS 2017 install is lingering around, confusing rustup. @retep998 Does that seem likely? Does everything work if you choose to continue? |
This comment has been minimized.
This comment has been minimized.
kosinix
commented
Apr 4, 2017
|
@Diggsey unfortunately no. :-( |
Diggsey
moved this from Error messages
to Documentation & CLI
in Issue Categorisation
May 4, 2017
Diggsey
added
enhancement
help wanted
labels
May 4, 2017
This comment has been minimized.
This comment has been minimized.
|
Thanks @levinem |
brson
referenced this issue
May 24, 2017
Closed
Add support for the Visual Studio 2017 linker #38584
brson
removed
the
help wanted
label
May 24, 2017
This comment has been minimized.
This comment has been minimized.
|
I've started a fix to gcc-rs: https://github.com/brson/gcc-rs/tree/vs2017 |
This comment has been minimized.
This comment has been minimized.
levinem
commented
May 24, 2017
|
You're welcome @brson |







projektir commentedMar 22, 2017
Previously, rustc and related tools worked fine for me, but I had VS itself installed with the C++ tools. I've just reinstalled Windows 10. I've installed Visual C++ Build Tools from the landinghub link, no SDK,, but when I run rustup-init.exe, it still tells me that it's missing. There's nothing else Rust or Visual Studio related on my machine.
I ran the installer again, but it has nothing to offer besides installing SDK's that I don't need.
I've installed updates and restarted my computer, but that didn't help.
I've added the Microsoft Visual C++ Build Tools folder to PATH, that didn't help, either.
Either rustup truly needs more than just the Build Tools themselves, or it's not doing a very good job of detecting it.