-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Linking with gcc
fails on Windows
#48737
Comments
This seems to be specific to your installation, it works fine for me (also Windows 7). It's weird that none of the files to be linked can be found, maybe gcc / ld doesn't like the cyrillic characters in the path? Although in that case you would expect the linking to never work. |
I did some experiments and found something very strange: if you put the same code in |
I wonder if it is related to making the linker command line long enough that it triggers the condition to pass in the linker command line by file. If so, it might be getting the encoding wrong. |
Indeed, I can reproduce this with |
Ideal workaround: Use the Alternative workaround: Disable incremental compilation and set codegen units to 1, thereby shortening the linker command line length. Ideal solution: Figure out how to encode the linker command file such that MinGW interprets it as unicode. Temporary hack: Disable using linker command lines with the gnu linker when on Windows. |
@suhr hm what version of |
Both toolchains seem to use gcc 6.3.0. |
Ah ok, I've got 7.2.0 in my environment, mind giving that a spin and see if it works? |
How to update it on Windows? |
Oh I personally use |
Well, this sounds somewhat complicated. |
@suhr ok I tested locally and 6.3.0 works for me as well. What's the output if you execute |
This is the gcc you get via rustup. I didn't do anything fancy, just used rustup. There's the output anyway:
|
Ah ok odd! In any case I tried a few more ways to reproduce this and have done a bit of digging. It look like unfortunately |
With that in mind @suhr I think your options are:
|
My experience with MSVC toolchain was unfortunate: it couldn't find So I decided to use the GNU toolchain and ran into this bug. |
Oh dear that also sounds bad! It's definitely our intention that the MSVC toolchain is automatically located and if it's not that's a bug on our end. It sounds like this is also a plausible bug for rustbuild to warn and/or refuse to install the MinGW target as a host in a path with non-ascii |
@suhr you are probably missing some of registry entries or environment variables. MSVC installer itself is very buggy and there is little Rust can do about it. For MinGW path issues response files could help but overall recommendation is to use short ASCII paths. Things could improve by using clang+lld on Windows but it's not quite ready yet, upcoming release 7.0 looks promising though. |
Insert my 15 cents. I tried to compile project with windows-gnu, but I had error simmilar to @suhr. It was because of my non-ASCII username |
Triage: Latest GCC and Binutils still don't handle I think we should leave this issue open since we ship |
The following code fails to link on both
stable-gnu
andnightly-gnu
toolchains:The build fails with the following output: https://gist.github.com/suhr/2962444f16cfce13bdc7118fe658a33c. Note that
hound
is a pure Rust crate.Strangely enough, a hello world without
hound
compiles just fine.OS: Windows 7, toolchain:
stable-gnu
andnightly-gnu
.The text was updated successfully, but these errors were encountered: