Cargo fails windows


#1

Hi!
I’m new on this.
I’ve installed rust on WSL with ubuntu 18.04 LTS AND on windows (after installing on WSL), in ubuntu all works fine, but on windows when I try to cargo run or cargo build, this happens.

I shouldn’t install rust in both systems?


(In cmd, the same result).


#2

I don’t know how you’ve managed it, but you appear to have gotten Rust to invoke the MSYS linker, rather than the MSVC linker. That’s not going to work.

You did install the MSVC build tools, yes?


#3

How can i know if i installed them?


#4

Look in the Add/Remove Programs list?

The VS Build tools aren’t something that surreptitiously sneaks on to your machine in the dead of night, cloaked in darkness and unintended install flags (unlike Candy Crush Saga); I’d hope you’d remember installing them.

If not, there’s information on the Install page for Rust (scroll down to “Windows considerations”).


#5

I’ve seen this happen even when MSVC build tools are installed. My solution is to just go to the cygwin/msys folder and rename “link.exe” there to something else such as “link-dont-mess-up-my-system-path-please.exe”.


#6

Actually, that brings up an excellent point: MSYS’ link should not be on your system PATH: it’s for linking “MSYS executables”, not normal Windows executables.

I assume it’s been put on PATH; I can’t think how else Rust managed to find it.


#7

link in MSYS isn’t even a linker. It’s used to create hard links. Regardless Rust will not invoke link.exe from PATH unless it is unable to locate all necessary VC++ components itself, in which case you most likely are missing some vital VC++ component like the Windows SDK.


#8

*facepalm* derp. I even know that!


#9

I’ve checked if i installed or not C++ building tools, and i didn’t. 6.5 GB of download… ok, rust windows can wait a few months, let’s use WSL. (Also, any reference link to cross building? (WSL ubuntu 18.4 -> W10 exe))

My current problem is that i can’t install the rust extension on vscode (installed on windows) having rust on WSL.

Should i rename the thread?

Update: searching, i’ve found this two 1, 2 pull requests on github. I’m waiting for it’s implementation on next user versions.


#10

The problem is that vscode will run on Windows, and therefore depend on Windows rust, and windows rust utilities, which includes rustup. So if you want to use rustup I’m afraid you need the MSVC build tools.


#11

Did you try the x86-64_gnu toolchain, by the way? It requires MinGW, which could be much lighter.