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

Tarpaulin fails to build binaries with --engine llvm on Nightly, when clap_builder crate is used in a project. #1681

Open
Sewer56 opened this issue Jan 17, 2025 · 3 comments
Assignees

Comments

@Sewer56
Copy link

Sewer56 commented Jan 17, 2025

Summary

Originally reported as:

Nightly builds of Rust (since around 2025, January, 12) fail to build the clap_builder crate when used in a project.
(Either directly or transitively)

Image

Image

As caught on my daily cron job that tests a GitHub Composite Action

To Reproduce

dummy_criterion.zip

Here's a dummy library project, with an attached dummy benchmark which uses criterion (most popular benchmarking library).
This is a 'realistic' setup, as benchmarking library projects is a fairly common use case. For a simpler setup

To reproduce the issue, build with cargo tarpaulin --engine llvm.

Sample stdout (from my machine):

➜  dummy_criterion git:(master) ✗ cargo tarpaulin --engine llvm
2025-01-16T19:40:23.675874Z  INFO cargo_tarpaulin::config: Creating config
2025-01-16T19:40:23.729267Z  INFO cargo_tarpaulin: Running Tarpaulin
2025-01-16T19:40:23.729275Z  INFO cargo_tarpaulin: Building project
2025-01-16T19:40:23.729278Z  INFO cargo_tarpaulin::cargo: Cleaning project
   Compiling proc-macro2 v1.0.93
   Compiling unicode-ident v1.0.14
   Compiling crossbeam-utils v0.8.21
   Compiling serde v1.0.217
   Compiling autocfg v1.4.0
   Compiling either v1.13.0
   Compiling serde_json v1.0.135
   Compiling libc v0.2.169
   Compiling rayon-core v1.12.1
   Compiling cfg-if v1.0.0
   Compiling clap_lex v0.7.4
   Compiling itoa v1.0.14
   Compiling plotters-backend v0.3.7
   Compiling memchr v2.7.4
   Compiling ryu v1.0.18
   Compiling ciborium-io v0.2.2
   Compiling regex-syntax v0.8.5
   Compiling anstyle v1.0.10
   Compiling cast v0.3.0
   Compiling same-file v1.0.6
   Compiling once_cell v1.20.2
   Compiling anes v0.1.6
   Compiling oorandom v11.1.4
   Compiling half v2.4.1
   Compiling num-traits v0.2.19
   Compiling walkdir v2.5.0
   Compiling itertools v0.10.5
   Compiling plotters-svg v0.3.7
   Compiling clap_builder v4.5.26
   Compiling ciborium-ll v0.2.2
   Compiling regex-automata v0.4.9
   Compiling criterion-plot v0.5.0
   Compiling crossbeam-epoch v0.9.18
   Compiling crossbeam-deque v0.8.6
   Compiling quote v1.0.38
   Compiling plotters v0.3.7
   Compiling syn v2.0.96
   Compiling is-terminal v0.4.13
   Compiling regex v1.11.1
   Compiling rayon v1.10.0
   Compiling serde_derive v1.0.217
error: could not compile `clap_builder` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
2025-01-16T19:40:25.390163Z ERROR cargo_tarpaulin: Failed to compile tests!
error: symbol `_RNCNCNvMs2_NtNtCs87SbzEJgdEg_12clap_builder7builder7commandNtB9_7Command29get_global_arg_conflicts_with00Bd_` is already defined
    --> /home/sewer/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap_builder-4.5.26/src/builder/command.rs:3992:39
     |
3992 | ...                   .flat_map(|x| x.args.args()),
     |                                 ^^^


Error: "Failed to compile tests!\nerror: symbol `_RNCNCNvMs2_NtNtCs87SbzEJgdEg_12clap_builder7builder7commandNtB9_7Command29get_global_arg_conflicts_with00Bd_` is already defined\n    --> /home/sewer/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap_builder-4.5.26/src/builder/command.rs:3992:39\n     |\n3992 | ...                   .flat_map(|x| x.args.args()),\n     |                                 ^^^\n\n"

Edit:

If you wish to test with an even simpler setup, simply try building any crate with a (direct or transitive) dependency on clap_builder, i.e.

[dev-dependencies]
clap_builder = { version = "4.5.26" }

That should reproduce the error.

Affected Platforms/Targets

To my awareness, all targets when using --engine llvm.

Which means on some platforms on nightly, it's not possible to do coverage at all as llvm is the only/default implementation.

I've tested on:

  • i686-unknown-linux-gnu
  • x86_64-unknown-linux-gnu
  • i686-pc-windows-msvc
  • x86_64-pc-windows-msvc

I don't have any hardware to text more exotic configurations, but in CI I've also seen failures for:

  • x86_64-apple-darwin
  • aarch64-apple-darwin

The default engine on Linux (ptrace) is not affected.

@Sewer56 Sewer56 changed the title Tarpaulin fails to build binaries with --engine llvm on Nightly (duplicate symbol) Tarpaulin fails to build binaries with --engine llvm on Nightly, when clap_builder crate is used in a project. Jan 17, 2025
@Sewer56
Copy link
Author

Sewer56 commented Jan 17, 2025

It's a very curious case; in any case. I don't know the exact details of the project internals here, how it all interacts with LLVM, etc.
Will wait for thoughts/feedback.

After some more poking around, I also noticed that simply depending on clap_builder in any capacity at all causes the build error; so I amended the original post to reflect this.

Notably tarpaulin itself also has a transitive dependency on clap_builder.

@XiNiHa
Copy link

XiNiHa commented Jan 17, 2025

For me, this also happens on stable if --doc is passed. (aarch64-apple-darwin)

@xd009642
Copy link
Owner

@XiNiHa doc test coverage needs nightly as it relies on unstable rust features so tarpaulin adds a +nightly for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants