-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix dynamic linking for Windows UWP MSVC targets #7758
Fix dynamic linking for Windows UWP MSVC targets #7758
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Eh2406 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This is a straight forward code change, and with @jblazquez grate explanation I am happy with it. @alexcrichton was very involved in reviewing the linked PR, so I want his opinion. |
@bors: r+ Nah I think this is fine to avoid a test, thanks @jblazquez! |
📌 Commit a1b8461 has been approved by |
…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.
☀️ Test successful - checks-azure |
Update cargo 9 commits in 86134e7666a088682f20b76278c3ee096a315218..6e1ca924a67dd1ac89c33f294ef26b5c43b89168 2019-12-23 16:08:07 +0000 to 2020-01-06 19:11:37 +0000 - Fix dynamic linking for Windows UWP MSVC targets (rust-lang/cargo#7758) - Fix CARGO_TARGET_triple_LINKER environment variable. (rust-lang/cargo#7763) - Remove metadata dep_kinds duplicates. (rust-lang/cargo#7756) - Check for a source defined multiple times. (rust-lang/cargo#7751) - Fix typo. (rust-lang/cargo#7735) - Fix config env vars that are prefix of another with underscore. (rust-lang/cargo#7748) - Add test for `cargo pkgid` (rust-lang/cargo#7741) - Add a note to the error message for using --feature / --no-default-features in a virtual workspace (rust-lang/cargo#7742) - Fix debug message. (rust-lang/cargo#7749)
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 astd-XXX.dll.lib
file and thus any executable that uses-C prefer-dynamic
will fail to link because thestd
library is not linked at all.This change relaxes the test and makes Cargo know about those import libraries for all Windows MSVC targets.