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

Simple Hello World can not Link #44787

Closed
bes1002t opened this issue Sep 23, 2017 · 28 comments
Closed

Simple Hello World can not Link #44787

bes1002t opened this issue Sep 23, 2017 · 28 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bes1002t
Copy link

I've installed Rust on Windows using rustup. In the end I want to cross compile from windows to raspbian stretch. In addition I've cygwin installed, so maybe this could be a problem, but I already uninstalled all cygwin gcc compiler packages. So which rustc shows "/cygdrive/c/Users/Ben/.cargo/bin/rustc". But I think rust is still using linker.exe from cygwin, I don't know whether rust brings its own linker or it is ok to use cygwins linker.

Rust installation worked without problems and this is what "rustc -Vv" returns:

rustc 1.20.0 (f3d6973f4 2017-08-27)
binary: rustc
commit-hash: f3d6973f41a7d1fb83029c9c0ceaf0f5d4fd7208
commit-date: 2017-08-27
host: x86_64-pc-windows-msvc
release: 1.20.0
LLVM version: 4.0

So it seems rust is successfully installed.
Then I wanted to compile a simple hello world for windows. This is the code of the hello world example:

fn main() {
    println!("Hello rusty World!");
}

I tried to compile it using "cargo run --verbose" and "rustc main.rs"
Both commands returned the following error:

Compiling hello_world v0.1.0 (file:///D:/home/Ben/projekte/Programmierung/Rust/HelloWorld)
Running rustc --crate-name hello_world src\main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=b9cd87cd2fe773f5 -C extra-filename=-b9cd87cd2fe773f5 --out-dir D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps -L dependency=D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps
error: linking with link.exe failed: exit code: 1 |
= note: "link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-b9cd87cd2fe773f5.0.o" "/OUT:D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-b9cd87cd2fe773f5.exe" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-b9cd87cd2fe773f5.crate.allocator.o" "/OPT:REF,NOICF" "/DEBUG" "/LIBPATH:D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps" "/LIBPATH:C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd-dd7c96bff832962e.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liballoc_system-c0ca30c8d8f2ee24.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\librand-a299d02141336ab8.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libpanic_unwind-5fee394736e5c5eb.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liblibc-d67437f4f22ef3c2.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\liballoc-db87982aeb7cd775.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libstd_unicode-9ffbffc259cf112a.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libunwind-9027c96a793ab959.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcore-e56c10976581c51e.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\libcompiler_builtins-4f8e9eb49e791bd8.rlib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "shell32.lib" "msvcrt.lib"
= note: link: extra operand ‘/LIBPATH:C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib’
Try 'link --help' for more information.

error: aborting due to previous error
error: Could not compile hello_world.

Caused by:
process didn't exit successfully: rustc --crate-name hello_world src\main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=b9cd87cd2fe773f5 -C extra-filename=-b9cd87cd2fe773f5 --out-dir D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps -L dependency=D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps (exit code: 101)

I googled a lot, updated rust, installed mingw64 and uninstalled it again. And it is still not working. In ##rust somebody told me that this could be a bug in rust. So I hope someone here can help me.

@retep998
Copy link
Member

retep998 commented Sep 23, 2017

You're using the x86_64-pc-windows-msvc version of Rust, which means you need the VC++ toolchain installed. Please install either the VC++ 2015 build tools or use the VC++ 2017 installer to install just the appropriate components (you need the VC++ toolchain itself, the windows SDK, and the universal crt). http://landinghub.visualstudio.com/visual-cpp-build-tools

The error you are getting is because you have a MinGW or Cygwin in your PATH, which happens to have a binary named link which is not the VC++ linker, but rustc doesn't seem to know that.

If you don't want to use VC++ (despite it being the superior option for natively targeting Windows), then you'll need the x86_64-pc-windows-gnu version of Rust. It comes with a bundled partial MinGW toolchain and is capable of linking pure Rust projects, but for anything involving C/C++ dependencies you'll need to acquire a full MinGW-w64 toolchain yourself. Notably, Rust does not support Cygwin for targeting Windows.

@bes1002t
Copy link
Author

bes1002t commented Sep 23, 2017

What would I need if I use the x86_64-pc-windows-gnu version?

Edit: Wording

@steveklabnik
Copy link
Member

It doesn't say that:

host: x86_64-pc-windows-msvc

@bes1002t
Copy link
Author

bes1002t commented Sep 23, 2017

I asked "if" I use it, not that I use it. I could change the default.

Edit: Wording

@retep998
Copy link
Member

retep998 commented Sep 23, 2017

What would I need when I use the x86_64-pc-windows-gnu version?

When you're doing pure Rust applications, the x86_64-pc-windows-gnu toolchain is self contained and contains everything you need. Just make sure you install the x86_64-pc-windows-gnu toolchain. Merely adding it as a target and cross compiling to it will need an external MinGW installation because the bundled MinGW is only used when the host and target are identical.

@bes1002t
Copy link
Author

Ok, I changed the host-triple and toolchain:

rustc 1.20.0 (f3d6973f4 2017-08-27)
binary: rustc
commit-hash: f3d6973f41a7d1fb83029c9c0ceaf0f5d4fd7208
commit-date: 2017-08-27
host: x86_64-pc-windows-gnu
release: 1.20.0
LLVM version: 4.0

I renamed the linker.exe from cygwin so there is no ld, linker.exe or something else I know left, that rust could use instead of its own linker to link my application.

But, the problem still occurs.

@retep998
Copy link
Member

What error are you getting when you do that? You definitely can't be getting the error you originally posted because that could only occur when using the msvc toolchains.

@bes1002t
Copy link
Author

I changed the toolchain and host-triple in my settings.toml that is located in my .rustup directory.
after the change to gnu I get the following error:

Compiling hello_world v0.1.0 (file:///D:/home/Ben/projekte/Programmierung/Rust/HelloWorld)
Running rustc --crate-name hello_world src\main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=49b2a6072ca4f9bf -C extra-filename=-49b2a6072ca4f9bf --out-dir D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps -L dependency=D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps
error: linking with gcc failed: exit code: 1
|
= note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsbegin.o" "-L" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-49b2a6072ca4f9bf.0.o" "-o" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-49b2a6072ca4f9bf.exe" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-49b2a6072ca4f9bf.crate.allocator.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps" "-L" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "-Wl,-Bstatic" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-af60d119b5ecb257.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liballoc_system-bff41e15980fe6cf.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\librand-2aa6c3d962245079.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-30371416d354e96f.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liballoc-d8c81490c2d62844.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd_unicode-bd574f07708f258e.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libunwind-58d47502a6216e0c.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liblibc-3d1e7ae71c47990a.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcore-d394f1676623d67c.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-4182e48900768b3a.rlib" "-Wl,-Bdynamic" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-Wl,-Bstatic" "-l" "gcc_eh" "-l" "pthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsend.o"
= note: gcc.exe: error: CreateProcess: No such file or directory

error: aborting due to previous error

error: Could not compile hello_world.

Caused by:
process didn't exit successfully: rustc --crate-name hello_world src\main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=49b2a6072ca4f9bf -C extra-filename=-49b2a6072ca4f9bf --out-dir D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps -L dependency=D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps (exit code: 101)

It looks to me like the same error as before. Maybe I should restart after the change to gnu?

@retep998
Copy link
Member

retep998 commented Sep 23, 2017

It's definitely a different error. Notice the = note: gcc.exe: error: CreateProcess: No such file or directory part. Do you have a gcc in your PATH, without a corresponding ld? Rust doesn't use ld directly, it invokes gcc to perform linking, and then gcc delegates to ld.

@bes1002t
Copy link
Author

ah I see.

No there is no GCC and no LD in my Path. I removed even all MinGw related stuff from my Path.
"which gcc" and "which ld" returns both "which: no $APPLICATION_NAME in $PATH".

You said before that the gnu toolchain contains already all I need, so I thought I don't need any gcc or mingw tools for Rust to compile. Am I wrong?

@retep998
Copy link
Member

The gnu toolchain is supposed to be self contained on Windows and not need anything installed to work. If you go to C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\bin you should be able to see the gcc.exe and ld.exe that Rust uses.

@bes1002t
Copy link
Author

No there is no gcc.exe and no ld.exe. There are some files like rustc.exe and cargo.exe but no gcc.exe or ld.exe. The only file that has something to do with gcc is "libgcc_s_seh-1".

@retep998
Copy link
Member

Are you sure you're looking in the folder I mentioned? rustc.exe and cargo.exe exist in toolchains\stable-x86_64-pc-windows-gnu\bin while the folder which has gcc.exe and ld.exe is toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\bin.

@bes1002t
Copy link
Author

You're totally right, it was the wrong directory. Anyway, I added the new directory to my PATH, so which gcc and which ld shows the exact path to this directory. After a reboot the build still fails with this error message:

Compiling hello_world v0.1.0 (file:///D:/home/Ben/projekte/Programmierung/Rust/HelloWorld)
Running rustc --crate-name hello_world src\main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=49b2a6072ca4f9bf -C extra-filename=-49b2a6072ca4f9bf --out-dir D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps -L dependency=D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps
error: linking with gcc failed: exit code: 1
|
= note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsbegin.o" "-L" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-49b2a6072ca4f9bf.0.o" "-o" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-49b2a6072ca4f9bf.exe" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps\hello_world-49b2a6072ca4f9bf.crate.allocator.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps" "-L" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "-Wl,-Bstatic" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-af60d119b5ecb257.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liballoc_system-bff41e15980fe6cf.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\librand-2aa6c3d962245079.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-30371416d354e96f.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liballoc-d8c81490c2d62844.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd_unicode-bd574f07708f258e.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libunwind-58d47502a6216e0c.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liblibc-3d1e7ae71c47990a.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcore-d394f1676623d67c.rlib" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-4182e48900768b3a.rlib" "-Wl,-Bdynamic" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-Wl,-Bstatic" "-l" "gcc_eh" "-l" "pthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\Users\Ben\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsend.o"
= note: gcc.exe: error: CreateProcess: No such file or directory

error: aborting due to previous error
error: Could not compile hello_world.

Caused by:
process didn't exit successfully: rustc --crate-name hello_world src\main.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=49b2a6072ca4f9bf -C extra-filename=-49b2a6072ca4f9bf --out-dir D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps -L dependency=D:\home\Ben\projekte\Programmierung\Rust\HelloWorld\target\debug\deps (exit code: 101)

@retep998
Copy link
Member

Because I can't reproduce this locally, and the error gives very little information, would you be willing to use procmon (Process Monitor) to trace all syscalls while you attempt to compile a hello world and then send me the PML logfile?

@XAMPPRocky XAMPPRocky added A-linkage Area: linking into static, shared libraries and binaries T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-windows-msvc Toolchain: MSVC, Operating system: Windows C-bug Category: This is a bug. labels Jan 22, 2018
@ghost
Copy link

ghost commented Mar 16, 2018

I have this issue as well. I'm trying to install the visual-cpp build-tools, and will report back if the issue persists

@ghost
Copy link

ghost commented Mar 16, 2018

installing the visual-cpp build-tools resolved my issues 👍 thank you, @retep998 !

@tomexsans
Copy link

Had problems with both my Windows 7 x64 and windows 10x64,
Turns out i just need to install Visual Studio Community 2017

https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15

on windows 8/10 you might want to install the windows 8/10 SDK's

image

@totalknowledge
Copy link

I have installed the MSVC build tools, but rust can't find them because the LLVM tools are in the path. Is there a way to tell rust where it should pull the build tools from? (if not there should be)

@pferrarezi
Copy link

I just had this issue on Windows 10 x86_64, with both Visual Studio 2017 and C++ tools for cmake installed.
I solved it by installing chocolatey.
And then installing Rust Visual Studio ABI by running on terminal:
choco install rust-ms

@samayo
Copy link

samayo commented Oct 6, 2018

Why are these things never mentioned in the docs?? Does just expect developers to waste 2 hours to make anything work?

@retep998
Copy link
Member

retep998 commented Oct 7, 2018

@samayo The book mentions that you have to install Visual C++ and rustup will even yell at you if you haven't installed Visual C++. We always want to improve the documentation so if you can point out a place where you think it should be mentioned and isn't, then we'd be glad to fix that.

@jimthereaper
Copy link

Had problems with both my Windows 7 x64 and windows 10x64,
Turns out i just need to install Visual Studio Community 2017

https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15

on windows 8/10 you might want to install the windows 8/10 SDK's

image

@tomexsans thanks for sharing the screen capture!!

@Reidond
Copy link

Reidond commented Jun 22, 2019

I had the same issue when compiling from x64 to i686 using gnu toolchain on windows. Switched to msvc toolchain and it worked!

@aelbore
Copy link

aelbore commented Oct 2, 2019

You're using the x86_64-pc-windows-msvc version of Rust, which means you need the VC++ toolchain installed. Please install either the VC++ 2015 build tools or use the VC++ 2017 installer to install just the appropriate components (you need the VC++ toolchain itself, the windows SDK, and the universal crt). http://landinghub.visualstudio.com/visual-cpp-build-tools

The error you are getting is because you have a MinGW or Cygwin in your PATH, which happens to have a binary named link which is not the VC++ linker, but rustc doesn't seem to know that.

If you don't want to use VC++ (despite it being the superior option for natively targeting Windows), then you'll need the x86_64-pc-windows-gnu version of Rust. It comes with a bundled partial MinGW toolchain and is capable of linking pure Rust projects, but for anything involving C/C++ dependencies you'll need to acquire a full MinGW-w64 toolchain yourself. Notably, Rust does not support Cygwin for targeting Windows.

Installing VC++ 2015 or 2017 resolved my issue

@skylei
Copy link

skylei commented Nov 15, 2019

For the first time:

The latest version of rust is installed

The second time:

Mingwin installed

An error occurred during compilation:

Through data inquiry

install

rustup install stable-x86_64-pc-windows-gnu

It's solved.

@sleeyax
Copy link

sleeyax commented Jan 21, 2020

I just upgraded from VS2017 to VS2019 and this issue happened unexpectedly. Thank god @tomexsans solution worked! <3

@workingjubilee
Copy link
Member

Rustup now can install the VC++ tools for you, so I am calling that good enough to close this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests