Skip to content

Commit 6e1ca92

Browse files
committed
Auto merge of #7758 - jblazquez:fix-windows-uwp-dynamic-linking, r=alexcrichton
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.
2 parents 5cca88f + a1b8461 commit 6e1ca92

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cargo/core/compiler/build_context/target_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl TargetInfo {
228228
}];
229229

230230
// See rust-lang/cargo#4500.
231-
if target_triple.ends_with("pc-windows-msvc")
231+
if target_triple.ends_with("-windows-msvc")
232232
&& crate_type.ends_with("dylib")
233233
&& suffix == ".dll"
234234
{

0 commit comments

Comments
 (0)