Description
I'm confused with this actually - fresh installation of Rust on Windows (MSVC ABI) fails to link hello world. I found this ticket but it's pretty old and it's closed, so I assume it was fixed. Let's go to the explanation.
This is the simple hello world (main.rs
):
fn main() {
println!("Hello, world!")
}
there is no any other files in project, no cargo setup or something.
Using rustc main.rs
I'm getting this error:
error: linking with `link.exe` failed: exit code: 1104
note: LINK : fatal error LNK1104: cannot open file 'ucrt.lib'
Based on the ticket above I provided compiler the path to ucrt.lib
with
rustc -L "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64" main.rs
and it works just fine.
Additional info:
- Rust is
rustc 1.8.0-beta.1 (facbfdd71 2016-03-02)
, MSVC ABI. (but error is the same with 1.7 stable. I didn't try nightly build). - OS is
Windows 10 Pro, x64
- Visual Studio is 2015 with all available patches installed.
- Rust
/bin/
directory have added to thePATH
environment variable.
So. Am I missed some installation steps or it's a problem with my environment?
UPD: Just tried to run compiler from VS developer command prompt and got the other error: note: msvcrt.lib(chkstk.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
and I have no clue how I can to change the architecture. I don't see a separate x64 version of VS dev cmd.
UPD2: I investigated further and found that linker message contains this command line option among the others: "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.10586.0\\ucrt\\x64"
. The weird part here that while my system has 10.0.10586.0
there is NO ucrt
folder in it. But it has 10.0.10150.0/ucrt/*
and 10.0.10240.0/ucrt/*
folders.
UPD3: Since this ucrt
folder obviously is the part of the Windows 10 SDK, I installed it manually from official page with ALL available checkboxes checked. Now I have 10.0.10586.0/ucrt/*
folders and compilation works without any additional steps. In the end I'm not sure should I close this ticket or such situation can be handled by installer or rustc
itself. Minor clarification: I DON'T installed Win 10 SDK manually before, 10.0.10150.0
version was installed either as dependency for some packages I've used in development or with VS updates. Somehow this installation was not full and didn't include this ucrt libraries.