-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
MSVC link output improve #62021
MSVC link output improve #62021
Conversation
i did some small experiments with link.exe, it seems to me it's like this:
|
By english do you also mean UTF-8? |
No i don't, i just mean these software stopped using any localized resources, and (coincidentally) the output can be handled the existing utf-8 handling code path. |
278ee20
to
19f8622
Compare
Found a better way. Just set this environment variable and the output will always be in English. |
Having the output always be in English seems suboptimal for users who don't really know English, because now they won't understand the linker messages. |
I think this is fine, since Rust compiler output is also always in English now. This can be changed when Rust supports multilingual compiler output in the future though. |
Thanks for the PR! I don't really think I fully understand the issue here though and how this fixes it. Is there documentation for what this env var is? Can you describe how it's fixing the issue? Can you describe a bit as to why the underlying issue is occuring? It seems like |
Hi, let me first try to describe the issue. Visual C++ build tools, like Since Microsoft-product localization is English-centric, the current PR changes simply suppresses those behavior, by adding an environment variable For the environment variable, i don't think Microsoft has public documentation. However many tools, both Qt from outside Microsoft, and Visual Studio, Dotnet CLI, MSBuild is respecting this behavior. Within dotnet/msbuild#1596, there're links that seems to give more detailed information but is not accessible to people outside Microsoft (like me). |
Thanks for the explainer! Is there any way we can force utf-8 output though? Or otherwise is it possible to use kernel32 functions to decode what the linker/tooling is handing us? |
We cannot force utf-8 output. However we actually can do the conversion, i actually did so in the first version of this PR. The code is here(on this branch of my fork): The cons is that we cannot prove that this conversion always work (e.g. cannot prove the source output is always in CP_OEMCP). Besides that, it's a little strange to mix localized messages into Rust compiler's always outputting English output session. I think you can compare the code to see which is better. I think both are better than the status quo. |
Ok thanks again for that! I agree that it's probably a bit too unnecessarily complicated to add that in. I think we could perhaps try to decode with a few options (one being CP_OEMCP) and maybe try to find which is closest to something we understand (e.g. utf-8), but I'm otherwise convinced that all other messages coming from rustc are English so we may as well just do the same for the linker. @crlf0710 could you add a comment to this new env var indicating what it's doing and why it's there? (basically what you've already mentioned in this PR). After that I think this is good to go! |
@alexcrichton done~ |
@bors: r+ |
📌 Commit 8339211 has been approved by |
@Centril maybe rollup this in next rollup, too? |
…r=alexcrichton MSVC link output improve Resolves rust-lang#35785. However i haven't come up with a idea to add test case for this :( r? @retep998
…r=alexcrichton MSVC link output improve Resolves rust-lang#35785. However i haven't come up with a idea to add test case for this :( r? @retep998
…r=alexcrichton MSVC link output improve Resolves rust-lang#35785. However i haven't come up with a idea to add test case for this :( r? @retep998
Rollup of 15 pull requests Successful merges: - #62021 (MSVC link output improve) - #62064 (nth_back for chunks_exact) - #62128 (Adjust warning of -C extra-filename with -o.) - #62161 (Add missing links for TryFrom docs) - #62183 (std: Move a process test out of libstd) - #62186 (Add missing type urls in Into trait) - #62196 (Add Vec::leak) - #62199 (import gdb for explicit access to gdb.current_objfile()) - #62229 (Enable intptrcast for explicit casts) - #62250 (Improve box clone doctests to ensure the documentation is valid) - #62255 (Switch tracking issue for `#![feature(slice_patterns)]`) - #62285 (Fix michaelwoerister's mailmap) - #62304 (HashMap is UnwindSafe) - #62319 (Fix mismatching Kleene operators) - #62327 (Fixed document bug, those replaced each other) Failed merges: r? @ghost
Resolves #35785.
However i haven't come up with a idea to add test case for this :(
r? @retep998