Skip to content

Commit 7d5d591

Browse files
Rollup merge of rust-lang#62021 - crlf0710:msvc_link_output_improve, 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
2 parents 8301de1 + 8339211 commit 7d5d591

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/librustc_codegen_ssa/back/link.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,14 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
653653
linker_error.emit();
654654

655655
if sess.target.target.options.is_like_msvc && linker_not_found {
656-
sess.note_without_error("the msvc targets depend on the msvc linker \
657-
but `link.exe` was not found");
658-
sess.note_without_error("please ensure that VS 2013, VS 2015 or VS 2017 \
659-
was installed with the Visual C++ option");
656+
sess.note_without_error(
657+
"the msvc targets depend on the msvc linker \
658+
but `link.exe` was not found",
659+
);
660+
sess.note_without_error(
661+
"please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 \
662+
was installed with the Visual C++ option",
663+
);
660664
}
661665
sess.abort_if_errors();
662666
}

src/librustc_target/spec/windows_msvc_base.rs

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ pub fn opts() -> TargetOptions {
1919
target_family: Some("windows".to_string()),
2020
is_like_windows: true,
2121
is_like_msvc: true,
22+
// set VSLANG to 1033 can prevent link.exe from using
23+
// language packs, and avoid generating Non-UTF-8 error
24+
// messages if a link error occurred.
25+
link_env: vec![("VSLANG".to_string(), "1033".to_string())],
2226
pre_link_args: args,
2327
crt_static_allows_dylibs: true,
2428
crt_static_respected: true,

0 commit comments

Comments
 (0)