Skip to content

Dependency crate with staticlib and rlib gets trimmed #1158

Closed

Description

@lissyx

In https://bugzilla.mozilla.org/show_bug.cgi?id=1760743 we got a regression from a few crates vendored within m-c that expose both staticlib and rlib. There is code to guard against trimming when a staticlib is generated in

sccache/src/compiler/rust.rs

Lines 1891 to 1899 in 5edd91a

// If we're just creating an rlib then the only thing inspected inside dependency rlibs is the
// metadata, in which case we can create a trimmed rlib (which is actually a .a) with the metadata
let can_trim_rlibs = matches!(
crate_types,
CrateTypes {
rlib: true,
staticlib: false,
}
);
but from my understanding of the code, crate_types at that point is the crate we are compiling, not the dependency we are pulling in.

e.g., compiling crate audioipc2 we have a dep on audio_thread_priority (which has both staticlib and rlib). So we get can_trim_rlibs=true because audioipc2 is a rlib only, but we apply trimming on audio_thread_priority, effectively triggering the issue.

Activity

  1. added 4 commits that reference this issue on Apr 14, 2022
    7e3f65e
    d899eb4
    cb42c84
    833809c
  2. added a commit that references this issue on Apr 14, 2022
    ec1457e
  3. added a commit that references this issue on Aug 10, 2022
    09cc9a8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions