Skip to content
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

Tracking issue for rustc-cdylib-link-arg transitive warning #9562

Open
ehuss opened this issue Jun 9, 2021 · 1 comment
Open

Tracking issue for rustc-cdylib-link-arg transitive warning #9562

ehuss opened this issue Jun 9, 2021 · 1 comment
Labels
A-build-scripts Area: build.rs scripts A-linkage Area: linker issues, dylib, cdylib, shared libraries, so C-tracking-issue Category: A tracking issue for something unstable. S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. S-waiting-on-feedback Status: An implemented feature is waiting on community feedback for bugs or design concerns.

Comments

@ehuss
Copy link
Contributor

ehuss commented Jun 9, 2021

In the 1.50 release, there was an unintended change that the cargo:rustc-cdylib-link-arg build script instruction started passing arguments to transitive cdylib dependencies. Previously this was ignored. In the 1.54 release, a warning was added to indicate that this may be rejected in the future.

If you see this warning, you are encouraged to change the way linker arguments are added. Only the build script of the package containing the cdylib should issue cargo:rustc-cdylib-link-arg in its build script. If there is common code for determining these flags that users may need, then an option is to have a build-dependency which provides that logic.

@thomcc
Copy link
Member

thomcc commented Nov 22, 2022

It seems like if you have:

  • crate A with crate-type=["cdylib", "rlib"], that emits println!("cargo:rustc-cdylib-link-arg=...") in its build.rs, and
  • crate B of type cdylib that depends on crate A

We'll apply the link args from A to both cdylibs (expected, given the current workaround), but fail to emit the warning, even though the 2nd crate is getting the cdylib args transitively (unfortunate, since that would probably break if we started rejecting transitive cdylib-link-args).

I'm not sure the best way to handle this though, but I figured I'd mention it here.

@ehuss ehuss added S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. S-waiting-on-feedback Status: An implemented feature is waiting on community feedback for bugs or design concerns. labels Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-scripts Area: build.rs scripts A-linkage Area: linker issues, dylib, cdylib, shared libraries, so C-tracking-issue Category: A tracking issue for something unstable. S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. S-waiting-on-feedback Status: An implemented feature is waiting on community feedback for bugs or design concerns.
Projects
Status: Small things todo
Development

No branches or pull requests

2 participants