-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Symbols from static libraries used by dependent crates are no longer included into cdylib #96192
Comments
I had hoped that #95604 would fix this since it seems very related, but I downloaded the try build and it does not appear to. |
It becomes clearer what happens if you build test.rs as an executable.
The build will just fail, while with cdylibs remaining unresolved symbols are ok by default.
What saved the build before #93901 is that rustc linked liblib as whole-archive in that particular case, so it wasn't dropped even if it wasn't needed. The right fix here is to specify that dep.rs depends on lib.c, by using |
Thanks for the detailed response! That makes sense, and the solution seems reasonable. I'm fine with saying that this is not a bug then. For what it's worth this happened because we're using Bazel and |
Here is the setup. This is all on
x86_64-unknown-linux-gnu
.lib.c
:dep.rs
:test.rs
:Then we run these commands:
Previously, this worked and linked
symbol
into the resulting cdylib:However, it now results in an unresolved symbol:
Which seems wrong, since we asked to link
liblib.a
intolibtest.so
. The issue also doesn't occur if the static library is used directly from the cdylib crate.Bisection reveals that the regression occurred in #95501, which is a rollup; the most likely culprit appears to be #93901.
The text was updated successfully, but these errors were encountered: