Rollup merge of #62021 - crlf0710:msvc_link_output_improve, r=alexcrichton

MSVC link output improve

Resolves #35785.

However i haven't come up with a idea to add test case for this :(

r? @retep998
This commit is contained in:
Mark Rousskov 2019-07-03 09:59:10 -04:00 committed by GitHub
commit 7d5d59160a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -653,10 +653,14 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
linker_error.emit();
if sess.target.target.options.is_like_msvc && linker_not_found {
sess.note_without_error("the msvc targets depend on the msvc linker \
but `link.exe` was not found");
sess.note_without_error("please ensure that VS 2013, VS 2015 or VS 2017 \
was installed with the Visual C++ option");
sess.note_without_error(
"the msvc targets depend on the msvc linker \
but `link.exe` was not found",
);
sess.note_without_error(
"please ensure that VS 2013, VS 2015, VS 2017 or VS 2019 \
was installed with the Visual C++ option",
);
}
sess.abort_if_errors();
}

View File

@ -19,6 +19,10 @@ pub fn opts() -> TargetOptions {
target_family: Some("windows".to_string()),
is_like_windows: true,
is_like_msvc: true,
// set VSLANG to 1033 can prevent link.exe from using
// language packs, and avoid generating Non-UTF-8 error
// messages if a link error occurred.
link_env: vec![("VSLANG".to_string(), "1033".to_string())],
pre_link_args: args,
crt_static_allows_dylibs: true,
crt_static_respected: true,