-
Notifications
You must be signed in to change notification settings - Fork 13.3k
--print native-static-libs
of a staticlib
crate does not print libraries linked in via #[link]
attribute or -l
parameters
#111643
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
Comments
It works as expected if the It seems to me that the rust/compiler/rustc_codegen_ssa/src/back/link.rs Lines 478 to 484 in a673ad6
is forgetting to add the current native libs. Doing something like this correctly adds all_native_libs.extend_from_slice(&codegen_results.crate_info.used_libraries); |
Yeah, I think adding |
Beware that |
I can't imagine it to be a deliberate omission as |
…r=bjorn3 Fix local libs not included when printing native static libs This PR fixes rust-lang/rust#111643 by adding the local used libs to the printed `--print=native-static-libs` output. It seems that `--print=native-static-libs` doesn't have any test, so I added one. It's very simple and doesn't even tries to compile the result to a binary as I don't know how to handle external library linking in CI. (Note that https://github.com/rust-lang/rust/blob/master/tests/run-make/staticlib-dylib-linkage/Makefile does compile to a binary) r? `@bjorn3`
This is with Rust 1.69 but was probably always the case.
Example:
lib.rs
Compiling with
prints
Similarly when providing
-lglib-2.0
nothing changes. I didn't really follow howrustc
collects the libraries but I think it's via thenative_libraries
query incompiler/rustc_middle/src/query/mod.rs
which claimsso this should be included AFAIU. Also the rationale of
native-static-libs
was to provide all libraries needed to link to the resultingstaticlib
, which is not the case in the above example.CC @kornelski who originally implemented this feature.
The text was updated successfully, but these errors were encountered: