-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Comments
You're using the The error you are getting is because you have a MinGW or Cygwin in your If you don't want to use VC++ (despite it being the superior option for natively targeting Windows), then you'll need the |
What would I need if I use the x86_64-pc-windows-gnu version? Edit: Wording |
It doesn't say that:
|
I asked "if" I use it, not that I use it. I could change the default. Edit: Wording |
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 |
Ok, I changed the host-triple and toolchain:
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. |
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. |
I changed the toolchain and host-triple in my settings.toml that is located in my .rustup directory.
It looks to me like the same error as before. Maybe I should restart after the change to gnu? |
It's definitely a different error. Notice the |
ah I see. No there is no GCC and no LD in my Path. I removed even all MinGw related stuff from my 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? |
The gnu toolchain is supposed to be self contained on Windows and not need anything installed to work. If you go to |
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". |
Are you sure you're looking in the folder I mentioned? |
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:
|
Because I can't reproduce this locally, and the error gives very little information, would you be willing to use |
I have this issue as well. I'm trying to install the visual-cpp build-tools, and will report back if the issue persists |
installing the visual-cpp build-tools resolved my issues 👍 thank you, @retep998 ! |
Had problems with both my Windows 7 x64 and windows 10x64, 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 |
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) |
I just had this issue on Windows 10 x86_64, with both Visual Studio 2017 and C++ tools for cmake installed. |
Why are these things never mentioned in the docs?? Does just expect developers to waste 2 hours to make anything work? |
@tomexsans thanks for sharing the screen capture!! |
I had the same issue when compiling from x64 to i686 using gnu toolchain on windows. Switched to msvc toolchain and it worked! |
Installing VC++ 2015 or 2017 resolved my issue |
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. |
I just upgraded from VS2017 to VS2019 and this issue happened unexpectedly. Thank god @tomexsans solution worked! <3 |
Rustup now can install the VC++ tools for you, so I am calling that good enough to close this bug. |
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:
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:
I tried to compile it using "cargo run --verbose" and "rustc main.rs"
Both commands returned the following error:
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.
The text was updated successfully, but these errors were encountered: