-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
dep-info doesn't contain statically linked libraries #58393
Comments
This may be the same as #57717? |
Yes, this sounds like the same issue. I don't think this actually impacts sccache though--we explicitly include static libraries/rlibs in the hash calculation: ...however testing locally shows that this isn't working as expected, so there may be an sccache bug here. |
After fixing a few assumptions (sccache won't cache the bin compilation in your example crate, and by default cargo will use incremental compilation which sccache also won't cache) I realize that mozilla/sccache#169 makes it impossible to validate this on Mac currently. |
It looks like so.
... except static libraries are not necessarily on the command line. The real usecase is libgkrust, and liblmdb.a is definitely not on the command line when it's built. |
Sure, it must be built into a crate that gets built into libgkrust, right? At some point it will be listed on a rustc command line and sccache will notice that, and the rlib that results from that compilation will be different, which feeds into the hash of any downstream crates. From your example above (I tweaked the crate to also have a lib.rs because sccache wouldn't cache compiling main.rs):
That foo.o is the object file compiled via build.rs. |
I did a local Linux build from current central and looked in the cargo output dir and found:
The mdb.o there is contained in liblmdb.a. It gets placed into liblmdb_rkv_sys.rlib:
Looking at a recent inbound build log shows
From your build log I can see
And then the
So the hash ought to be included transitively since we hash externs for rustc compiles. Unfortunately there are a lot of moving pieces here so it's hard to tell where exactly things have gone wrong. |
This is happening again in Firefox, in a more insidious way. This time it involves ASAN, and we can't really brush the problem away. A reproducer for this new instance, to show the extent of the problem, looks like the following:
What you'll see from the So, as far as sccache is involved, when libqux.a is built, all it knows is about libbar-.rlib, and since that doesn't contain foo.o, libbar-.rlib doesn't vary when foo.o varies, and sccache doesn't know that libqux.a varies when foo.o varies. A workaround for this is to add a dependency on foo in qux... |
…. r=chmanchester See rust-lang/rust#58393 (comment) Differential Revision: https://phabricator.services.mozilla.com/D56129 --HG-- extra : moz-landing-system : lando
Using the example from #58393 (comment) I can see that sccache knows |
…. r=chmanchester See rust-lang/rust#58393 (comment) Differential Revision: https://phabricator.services.mozilla.com/D56129 UltraBlame original commit: b515b0637e5eaf851af4a5aa1f8668c02d1a38ab
…. r=chmanchester See rust-lang/rust#58393 (comment) Differential Revision: https://phabricator.services.mozilla.com/D56129 UltraBlame original commit: b515b0637e5eaf851af4a5aa1f8668c02d1a38ab
…. r=chmanchester See rust-lang/rust#58393 (comment) Differential Revision: https://phabricator.services.mozilla.com/D56129 UltraBlame original commit: b515b0637e5eaf851af4a5aa1f8668c02d1a38ab
…. r=chmanchester See rust-lang/rust#58393 (comment) Differential Revision: https://phabricator.services.mozilla.com/D56129
@chmanchester I don't think there's away to get this dependency information right now unfortunately, this would require changes to rustc. |
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713 UltraBlame original commit: 060254b3ad73855146cd3d6147e50fbc514e1cdc
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713 UltraBlame original commit: 513d01d2b20cb2d485c30b7144a6bd83fd31b22c
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713 UltraBlame original commit: 060254b3ad73855146cd3d6147e50fbc514e1cdc
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713 UltraBlame original commit: 513d01d2b20cb2d485c30b7144a6bd83fd31b22c
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713 UltraBlame original commit: 060254b3ad73855146cd3d6147e50fbc514e1cdc
…t dependencies for sccache. r=glandium See rust-lang/rust#58393 Differential Revision: https://phabricator.services.mozilla.com/D85713 UltraBlame original commit: 513d01d2b20cb2d485c30b7144a6bd83fd31b22c
…x-build-system-reviewers,sergesanspaille It was disabled in bug 1525760 because of rust-lang/rust#58393 but since then we actually implemented a workaround (in bug 1601704) That workaround, however, is also needed on the newly added crashreporter crate. Ironically, if these tasks had had sccache enabled in the first place, bug 1911513 wouldn't have been caught. Differential Revision: https://phabricator.services.mozilla.com/D218611
…x-build-system-reviewers,sergesanspaille It was disabled in bug 1525760 because of rust-lang/rust#58393 but since then we actually implemented a workaround (in bug 1601704) That workaround, however, is also needed on the newly added crashreporter crate. Ironically, if these tasks had had sccache enabled in the first place, bug 1911513 wouldn't have been caught. Differential Revision: https://phabricator.services.mozilla.com/D218611
Consider the following dummy crate:
Now run
cargo run
. It will work as expected, printingfoo
.The problem is that
foo-*.d
doesn't contain anything to do with libfoo.a, which is obviously a dependency. One consequence of this is that sccache relies on this dep-info for its caching, and changes to libfoo.a are completely ignored. One real-world consequence is that on Firefox CI, jobs that build C/C++ code with clang 3.9 still get a libgkrust.a where C code was built with clang 7 (and vice-versa, depending which cached first).Cc: @alexcrichton @luser @froydnj
The text was updated successfully, but these errors were encountered: