Skip to content

build-override results in the same dependency being compiled twice #12645

@link2xt

Description

@link2xt

Problem

I am compiling tag v1.121.0 of https://github.com/deltachat/deltachat-core-rust with command cargo build. It compiles aho-corasick v1.0.2 dependency twice, once as a dependency and once as a build dependency, resulting in two .rlib field being produced and actually slowing down the build process rather than speeding it up as intended by the build-override feature.

Steps

  1. Clone https://github.com/deltachat/deltachat-core-rust, tag v1.121.0, commit a8551510cdb5be7a35ebd3574df79d15a4fa471a
  2. Run cargo build -v.
  3. Observe aho-corasick v1.0.2 dependency being compiled twice. Once as a proper dependency with -C panic=abort as specified in the manifest, and once as a build dependency without -C panic=abort.
  4. Try to specify panic='abort' in the [profile.dev.build-override] section of Cargo.toml as a workaround, it results in an error "panic may not be specified in a build-override profile".

Possible Solution(s)

Do not apply build-override to dependencies that are actual dependencies of the project? Or allow to disable build-override completely.

Notes

I wrote a longer thread with my observations of the build times and duplicate builds of dependencies at https://users.rust-lang.org/t/same-dependency-has-four-different-debug-fingerprints/99580

Version

$ cargo version --verbose
cargo 1.72.0
release: 1.72.0
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.2.1 (sys:0.4.63+curl-8.1.2 system ssl:OpenSSL/3.1.2)
os: Arch Linux [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-scriptsArea: build.rs scriptsA-profilesArea: profilesC-bugCategory: bugS-needs-team-inputStatus: Needs input from team on whether/how to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions