Skip to content
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

rustup should suggest Windows 11 SDK while installing on Windows 11 #2912

Open
Tracked by #3059
arnabanimesh opened this issue Dec 2, 2021 · 15 comments
Open
Tracked by #3059

Comments

@arnabanimesh
Copy link

Problem you are trying to solve

On Windows 11, it suggests installing Windows 10 SDK instead of Windows 11 SDK. Latest SDK improvements and security improvements need to be supported.

Solution you'd like

Suggest latest supported Windows SDK instead of a specific version

Notes

No response

@rbtcollins
Copy link
Contributor

rbtcollins commented Dec 2, 2021 via email

@kinnison
Copy link
Contributor

kinnison commented Dec 2, 2021

I'd be willing to have the recommendation URL change based on the OS you're installing on. If installing on win 10 recommend the win 10 SDK, if on win 11, recommend the win11 one but also mention the win10 one if you are developing for older systems. There's no point in us making it harder for people coming to Rust to develop apps which will work in a wider area.

@rbtcollins
Copy link
Contributor

https://www.reddit.com/r/rust/comments/r6vkge/when_will_rust_support_windows_11_sdk/ seems to be the genesis of this discussion. Its not clear to me that rustc actually uses the windows 10 or 11 SDK at all: the windows crates involved are https://github.com/microsoft/windows-rs or https://github.com/retep998/winapi-rs. The latter is hand-crafted, no dependency on the SDK. The former is also independent of the SDK as far as I can tell - its a projection of metadata from the https://github.com/microsoft/win32metadata project.

So I really do mean 'Is that what rustc needs?'. If this request is coming from folk confused about what is needed, great, lets fix that. If its coming from rustc having some need for a different SDK when targeting windows programs, then great lets fix that.

@kinnison
Copy link
Contributor

kinnison commented Dec 2, 2021

I think I possibly misunderstood - this is likely referring to https://github.com/rust-lang/rustup/blob/master/doc/src/installation/windows.md?plain=1#L15 which mentions ensuring you install the Windows 10 SDK, which is likely to ensure there's a C runtime etc. Not sure how to improve this without introducing confusion.

@arnabanimesh
Copy link
Author

Just mention Windows 10 SDK or newer. It should suffice.

@ChrisDenton
Copy link
Member

The Windows SDK is required for every msvc application that uses the standard library. It includes import libraries for core system functions (e.g. from kernel32 et al). In the future this may be made optional (see raw_dylib) but that isn't the case at the moment.

For most stuff it doesn't particularly matter which version you use so long as it has the symbols the standard library needs. Although it may matter if you make use of any utilities. etc that come with the SDK (though these aren't used by Rust itself) or want to use newer symbols (and don't want to use the windows crate).

@rbtcollins
Copy link
Contributor

Ok so concretely if I read this right:

  • rust targeting MSVC needs the build tools + import libraries for the windows APIs in use, and currently nothing in std::sys requires a Windows 11 import library.
  • third party crates may require Windows 11 import libraries
  • rust in future might require Windows 11 import libraries [though presumably compat discussions make that harder]
  • the SDK also includes tool that people may choose to use.

So I think rustup should say something a little closer to this than it does today: something like Rust requires MSVC build tools and Windows API import libraries in order to compile Rust programs targetting the Windows MSVC runtime. These can be obtained by installing any current release of the MS Windows desktop development SDK.

thoughts?

@ChrisDenton
Copy link
Member

ChrisDenton commented Dec 3, 2021

Hm, the problem is that wording isn't particularly actionable. Whereas "Windows 10 SDK" directly describes something that can be selected in the installer. I'd prefer to have a clear and concise answer to "what should I do next?".

For reference, here's a screenshot of the current Visual Studio installer (this is the build tools installer, but other installers aren't too different):

Screenshot

buildtools

@ChrisDenton
Copy link
Member

Just thinking outside the box a bit, but an alternative might be for rustup to offer to download the installer and pre-select the correct components. So all the user has to do is accept the license and click through to install.

@saintjer2224
Copy link

@garretwilson
Copy link

garretwilson commented May 16, 2023

It would be nice if this were addressed for newcomers (like me) who have the exact same questions installing Rust. Do I need the Windows 10 SDK, the Windows 11 SDK, or is an SDK even needed?

And here's another question: can I select the "Individual Components" tab and reduce the required components even further? I don't want to be installing additional Microsoft cruft if I don't need to if I just want to program Rust.

@rbtcollins
Copy link
Contributor

@garretwilson you don't need to install any Microsoft components if you instead install mingw and use the gnu toolchain on Windows. If you consider Microsoft developer tools cruft, you might prefer that approach.

I think from the perspective of the rustup team, our job is to get Rust installed as simply as possible, and since using the GNU toolchain on windows is not the common path, we don't default to that. (In particular there have been performance implications in the past).

If someone wants to work on making the current instructions better, or increasing the level of automation, by all means go ahead.

However, note that the current instructions are a good compromise between being super narrow but fragile as MS change their developer tools installation UI, and large but installing many unrelated things.

@garretwilson
Copy link

garretwilson commented May 17, 2023

If you consider Microsoft developer tools cruft …

Objectively speaking, if the minimal Microsoft-related install is like 8GB (if I remember correctly—it's several gigabytes at least), just to be able to compile a program written in Rust, then I will bet you a beer that there is cruft somewhere in there. 😉

Plus I'm restricted by the Microsoft license in what I can do. One can quibble and say, "oh, but you can develop open-source software" or whatever, but why should I go have to read some lawyer's small print and install gigabytes and gigabytes of stuff on my machine just to be able to print "hello world" using Rust on one of the most popular computer platforms on the planet? I'm just giving you a perspective on why I said "cruft".

… if you instead install mingw and use the gnu toolchain on Windows …

Awesome!! How do I do that? Tell me how, and I'll immediately uninstall this Microsoft license-restricted bloat.

(I actually searched for how to do that first, but I could only find a few comments from years ago in forums about what might work.)

If someone wants to work on making the current instructions better, or increasing the level of automation, by all means go ahead.

My Rust level isn't enough to add anything to the installer yet, but I can write instructions! I'm not a mingw expert. Please point me to the tools I need, I'll try it out, and then be happy to contribute to the docs.

@garretwilson
Copy link

So as not to get this ticket side-tracked and off-topic, I've opened #3358 for further discussion.

@hichemfantar
Copy link

hichemfantar commented May 24, 2024

I'm on Windows 10: Rustup suggested Windows 11 SDK
Will install and confirm if it works
image
Edit: looks like the w11 sdk works fine on w10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants