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

rustc --emit=dep-info -Zbinary-dep-depinfo -C prefer-dynamic=yes misses .so input dep #90106

Open
fangism opened this issue Oct 20, 2021 · 2 comments
Labels
-Cprefer-dynamic Codegen option: Prefer dynamic linking to static linking. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@fangism
Copy link

fangism commented Oct 20, 2021

With a command like:

rustc --emit=dep-info=foo.d -Zbinary-dep-depinfo -C prefer-dynamic ...

which uses the rust std library:

libstd-dafa2c58b8297b90.rlib
libstd-dafa2c58b8297b90.so

I expected to see both the .rlib and .so in the generated depfile, however, the .so is missing.

Meta

rustc --version --verbose:

rustc 1.57.0-nightly (af9b508e1 2021-10-15)
binary: rustc
commit-hash: af9b508e1d6c83a8f0e6f5c0b2b75598aa37ed27
commit-date: 2021-10-15
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0

Why this is important: We rely on the depfile to know what inputs to upload for remote building. When the .so file is missing we find that rustc still silently and happily builds the crate, but with a different (static?) linking result, which means local output != remote output (but we want perfect reproducibility).

@fangism fangism added the C-bug Category: This is a bug. label Oct 20, 2021
@bjorn3
Copy link
Member

bjorn3 commented Jul 14, 2023

You need the unstable -Zbinary-dep-depinfo to get the depinfo for anything other than the source files of the current crate. Cargo internally registers extra file dependencies for all --extern arguments it passes.

Tracking issue: #63012

Edit: Somehow completely overlooked that you passed -Zbinary-dep-depinfo. 🤦 I think #113695 will fix this as side effect for all crates that actually get linked. For rlib crates -Cprefer-dynamic doesn't have any effect and rustc only needs the crate metadata from the rlib (or .rmeta file) anyway.

@workingjubilee workingjubilee added the -Cprefer-dynamic Codegen option: Prefer dynamic linking to static linking. label Apr 6, 2024
@bjorn3
Copy link
Member

bjorn3 commented Apr 6, 2024

This is still the case even now that #113695 has been merged.

@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage-legacy labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Cprefer-dynamic Codegen option: Prefer dynamic linking to static linking. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants