Skip to content

Commit

Permalink
Auto merge of #7758 - jblazquez:fix-windows-uwp-dynamic-linking, r=al…
Browse files Browse the repository at this point in the history
…excrichton

Fix dynamic linking for Windows UWP MSVC targets

When creating a dynamic library, the MSVC linker generates an import library (.lib) next to the .dll file. Cargo has explicit knowledge of this and includes those generated .dll.lib on the list of files generated by a Cargo invocation.

However, the check to see if those import libraries must be included is too strict and doesn't match any Windows targets that don't end in `pc-windows-msvc`. For example, rust-lang/rust#63155 added several new Windows targets for targeting UWP called `*-uwp-windows-msvc`. The end result is that the sysroot for these UWP toolchains don't contain a `std-XXX.dll.lib` file and thus any executable that uses `-C prefer-dynamic` will fail to link because the `std` library is not linked at all.

This change relaxes the test and makes Cargo know about those import libraries for all Windows MSVC targets.
  • Loading branch information
bors committed Jan 6, 2020
2 parents 5cca88f + a1b8461 commit 6e1ca92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/build_context/target_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl TargetInfo {
}];

// See rust-lang/cargo#4500.
if target_triple.ends_with("pc-windows-msvc")
if target_triple.ends_with("-windows-msvc")
&& crate_type.ends_with("dylib")
&& suffix == ".dll"
{
Expand Down

0 comments on commit 6e1ca92

Please sign in to comment.