No entry on rust-lang web site about msvs builds tools and windows sdk

Hello, i could not find on Rust web site in Installation and in getting started tutorial any messages, that i should install also Windows SDK and Visual Studio Build Tools.
Should i be Nostradamus or Vanga to read mind of Rust creators and guess myself about it?

2 Likes

It's mentioned here: https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows

so i need to read documentation in order to install the language???? is it adequate???
so Rust team should than put this info in the rust-lang page, it is nonsense that to install language i should read documentation, no other languages do that or all info is written in web site, but no in Rust case

I think a mention of this requirement should be added to this page. You can open an issue in this repo.

Do note that rustup itself tells you when you run it.

I don't have a box without VS installed to test and get the exact message, but when running rustup for the first time, if it doesn't detect the required VS build tools, it says something along the lines of "Rust requires the Visual Studio C++ Build Tools, which you get by installing Visual Studio with C++ or can get separately at . Or, if you know what you're doing, you can continue with install or use the -gnu toolchain."

1 Like

To be precise:

Rust requires the Microsoft C++ build tools for Visual Studio 2013 or later, but they don't seem to be installed.

The easiest way to acquire the build tools is by installing Microsoft Visual C++ Build Tools 2019 which provides just the Visual C++ build tools:

https://visualstudio.microsoft.com/visual-cpp-build-tools/

Please ensure the Windows 10 SDK and the English language pack components are included when installing the Visual C++ Build Tools.

Alternately, you can install Visual Studio 2019, Visual Studio 2017, Visual Studio 2015, or Visual Studio 2013 and during install select the "C++ tools":

https://visualstudio.microsoft.com/downloads/

Install the C++ build tools before proceeding.

If you will be targeting the GNU ABI or otherwise know what you are doing then it is fine to continue installation without the build tools, but otherwise, install the C++ build tools before proceeding.

1 Like

I think such dependencies should be declared up front instead of suddenly required when you think you're almost done. Installing MS build tools requires admin rights, internet access, and noticeable time investment, so the user really should know about this requirement in advance.

these surprises must be written on web page in installation page, rustc also demand Windows SDK from me. Rust team as i see dont care about others

I was just noting that the information isn't just available in The Book, but also as part of the installation process. While it's not ideal to have to bounce back to a web browser to go install VS, you're not left with a non-working install without warning.

I agree that the requirement could be made more upfront, though. Though on the other hand: VC++ isn't needed to build Rust on Windows, because the -gnu toolchain works perfectly well (for 95% of things).

I'm not sure I get the problem. I'm a newbie to Windows, having been Linux only since 1999, but I got Rust installed on my Win 10 box without any drama just starting from the Rust front page: https://www.rust-lang.org/tools/install

Yes, it might be annoying to find you need some dependencies after you have started installation. But, meh, I thought that was normal. Even the best of installation instructions can miss some detail. That is OK the installer let's you know soon enough.

What I do find annoying is the need to install anything from MS to get Rust working.

no! rustc doesnt compile with my gcc, it writes i need linker, it doesnt work with gcc , only MS VStudio is required

At an absolute minimum you would need a linker from somewhere. So that's either the platform linker (which is obviously Microsoft's) or GNU (which can be distributed with Rust). In the future Rust may also ship LLVM's linker on Windows.

But that's just the theoretical minimum. At the moment Rust also needs more than just a linker. It needs certain functions (like memcpy, memcmp, etc and C++ exception handlers for panics). It also needs import libraries for interfacing with system dlls (e.g. "Kernel32", etc). All of this could be replaced with Rust code but it'd be a lot of work to create and keep current.

GNU does provide these though the results aren't always optimal. However it's usually mostly good enough if all you're looking for is "it works".

Ah, OK, clearly I have missed a point or two along the way.

I thought Rust lived on top of LLVM and that was it, job done. Clearly this is not the case.

I have to chuckle at the the thought that Rust needs gigabytes of MSVC to provide such trivial functions as memcpy, memcmp and the like. We used to write those in a few lines of assembler back in the day.

The fact that Rust is tied to C++ exception handler mechanisms is somewhat disturbing to me for some reason.

Anyway, I use Rust in the WSL on Win 10, running Debian. That goes much more easily. Why would anyone want a Windows install?

LLVM (or Cranelift or whatever) generates the machine code version of your program; it does not generate the support routines necessary to interface to the target environment. If you are doing bare-metal programming, you may not need or expect such support routines, but if you are running in a major OS environment you surely do need them.

Fortunately modern implementations are not so trivial. They are optimized for the platform and hardware. If they were trivial implementations then Rust programs would be a lot slower to run.

It would have been more accurate of me to say that Rust uses some of the same infrastructure that C++ exception handlers use, if that makes you feel better.

Because they're developing for Windows.

If you install (and use) the windows-gnu toolchain, rustc is a self-contained binary that uses mingw and has no external dependencies*, and definitely not VS. If it's still complaining about link.exe, you're using the MSVC toolchain and not the MinGW one.

The windows-gnu rustc definitely works without VS installed. I used it for multiple years where something about my computer setup caused VSWhere not to be able to keep track of my VS installation, requiring a reinstall every week to keep using the MSVC toolchain.

* Nowadays it'll use the system mingw if you have one, but it still comes with a bundled version that it'll use if there isn't a system one.

2 posts were split to a new topic: Windows Rust compiler not using mingw as linker

Well, I'm sure what I am told here is true. There is a reason for all this.

Forgive a grumpy old man for being grumpy but something has gone horribly wrong in the last four decades.

Back in the day we could compile languages like C, Pascal, PL/M on machines clocked at a mega hertz in only 64k bytes of RAM.

Today we need multi-gigabytes of compiler and support tools. There can be all kind of dependencies that are hard to sort out, as in this thread. And it still takes an hour to build a simple program running on giga hertz machines.

I'm not blaming blame anywhere but that is the user (the programmer) experience comparison.

Compilers also do a lot more nowadays then they did back then. OSes also do a lot more than they did back then.

Build systems are more complicated because software is more complicated. Doing things properly in the context of an OS is more complicated than what had to be done to get a program working four decades ago.

I have no doubt that is true.

My observation of programmer experience over the decades is also true.

I guess it would help if we standardized on such fundamentals as processor instruction set, operating system interface and the like decades ago. In the same way mechanical engineers standardized screw threads and the like over a hundred years ago.

Our industry has not reach that level of maturity yet. Hence the ever churning chaos we have to put up with and work around all the time.

1 Like