-
Notifications
You must be signed in to change notification settings - Fork 448
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
Support native library modifiers (RFC 2951) #671
Conversation
I for one would argue that |
I'd say the full name is "native library modifiers" because they are not necessarily about linking in the narrow sense, since they can also control bundling of native libraries into rlibs/staticlibs or potentially deduplication before linking. |
In the context "native" is effectively synonymous with "ffi" and Just a reminder, I'm just a cc-rs user weathering #663. |
Renamed to |
Ping @m-ou-se. |
Hi! Is this cargo feature documented anywhere? The docs only shows the |
This is a rustc syntax (https://doc.rust-lang.org/nightly/rustc/command-line-arguments.html#-l-link-the-generated-crate-to-a-native-library), cargo just passes the But I agree that the cargo docs also need to be updated, I'll send a PR. |
Ah great. Can you add a link to that in the doc comment for Then one more question: The |
Done.
Both resetting and appending method could potentially make sense in both cases. (I've changed the parameter from |
Thanks @petrochenkov. I'm also very interested in your addition because the Rust 1.61 change rust-lang/rust#93901 breaks my application at runtime (although it compiles and links successfully). Using |
@helgoboss println!("cargo:rustc-link-lib=static:+whole-archive={}", lib_name);
println!("cargo:rustc-link-search=native={}", env::var("OUT_DIR")); Ping @m-ou-se again. |
@petrochenkov Thanks, good to know. Your solution is much more convenient though. |
The other methods like Right now it doesn't matter much with only |
Updated in accordance with #671 (comment). |
ping @m-ou-se |
This fixes the build for Rust 1.61+ on some machines. I can reliably reproduce this locally, but CI does not exhibit this issue (I'm not sure why). The Rust compatibility notes document this change: https://github.com/rust-lang/rust/blob/1.61.0/RELEASES.md#compatibility-notes and eventually this will be supported by cc: rust-lang/cc-rs#671 Fixes #339
rustc >=1.61.0 breaks the build of our Python API (see https://github.com/rust-lang/rust/blob/1.61.0/RELEASES.md#compatibility-notes). Lets wait for rust-lang/cc-rs#671 to land and hardcode the CI environment to 1.60.0 for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks.
Can this be merged in some form and released before the Rust 1.61 release?
Obviously we missed the boat here, but I'll try to cut a release after I finish going through the pending PRs and merging the ones that are viable.
rust-lang/cc-rs#671 has now been merged and released, so a247218 is now unncessary.
cc rust-lang/rust#81490
I haven't added a test because stabilization of the feature has just landed on nightly and is not available on stable yet, but I've tested it manually.
Closes #689.