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

Build failure due to bitvec dependency #331

Closed
PatrickLerner opened this issue Feb 13, 2021 · 3 comments · Fixed by #333 or #334
Closed

Build failure due to bitvec dependency #331

PatrickLerner opened this issue Feb 13, 2021 · 3 comments · Fixed by #333 or #334
Labels
bug Something isn't working

Comments

@PatrickLerner
Copy link

Describe the bug

Cargo deny fails to install on a clean docker image. I am posting here in case somebody else is wondering or if there is a fix that can be done for this here, although I think it boils down to a dependency's dependency (see below).

Give a docker file such as:

FROM rust:1.50

RUN cargo install cargo-deny

The build fails due to a dependency:

error[E0034]: multiple applicable items in scope
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.19.4/src/order.rs:315:15
    |
315 |         if ct == R::BITS {
    |                     ^^^^ multiple `BITS` found
    |
note: candidate #1 is defined in the trait `BitMemory`
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/bitvec-0.19.4/src/mem.rs:29:2
    |
29  |     const BITS: u8 = mem::size_of::<Self>() as u8 * 8;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `IsNumber`
   --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/funty-1.2.0/src/lib.rs:144:2
    |
144 |     const BITS: u32;
    |     ^^^^^^^^^^^^^^^^
help: disambiguate the associated constant for candidate #1
    |
315 |         if ct == BitMemory::BITS {
    |                  ^^^^^^^^^^^^^^^
help: disambiguate the associated constant for candidate #2
    |
315 |         if ct == IsNumber::BITS {
    |                  ^^^^^^^^^^^^^^

   Compiling cc v1.0.66
error: aborting due to 43 previous errors

Some errors have detailed explanations: E0034, E0308.
For more information about an error, try `rustc --explain E0034`.
error: could not compile `bitvec`

Error also reported there: ferrilab/bitvec#105

But traced back to yet another package funty

To Reproduce
Steps to reproduce the behavior:

  1. Dockerfile above
  2. docker build . -t cargo-deny-fail -f Dockerfile
  3. See error

Expected behavior

It compiles on a clean system.

@PatrickLerner PatrickLerner added the bug Something isn't working label Feb 13, 2021
@repi
Copy link
Contributor

repi commented Feb 13, 2021

Thanks for the report!

cargo install unfortunately defaults to ignore Cargo.lock in the crate when installing, so it will use the latest minor/patch versions of all crates which in this case, as you point out, there is a dependency with a semver incompatible breaking change.

I think easiest approach for now, until that downstream dependency has been fixed, and in general, would be to use cargo install cargo-deny --locked, where the --locked flag makes sure it builds the crate with the provided and tested exact dependencies from Cargo.lock that is checked into this repo.

This Cargo issue / design choice is further discussed in rust-lang/cargo#7169.

@Jake-Shadle we could change the cargo-deny docs to recommend cargo install cargo-deny --locked instead of cargo install cargo-deny?

matthiasbeyer added a commit to science-computing/butido that referenced this issue Feb 15, 2021
This is also necessary due to the breaking, semver incompatible release
of bitvec.

Rationale:

    EmbarkStudios/cargo-deny#331

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Jake-Shadle added a commit that referenced this issue Feb 15, 2021
@Jake-Shadle Jake-Shadle mentioned this issue Feb 15, 2021
@briansmith
Copy link

When using --locked, I get this warning:

package `miow v0.3.5` in Cargo.lock is yanked in registry `crates.io`, consider running without --locked

It seems like it is warranted to release a new version that has an updated miow in the Cargo.lock, at least.

briansmith added a commit to briansmith/webpki that referenced this issue Feb 17, 2021
Add `--locked` to work around
EmbarkStudios/cargo-deny#331 and because it's
probably the more correct thing to do.
briansmith added a commit to briansmith/webpki that referenced this issue Feb 17, 2021
Add `--locked` to work around
EmbarkStudios/cargo-deny#331 and because it's
probably the more correct thing to do.
@Jake-Shadle
Copy link
Member

@briansmith I've made a 0.8.6 release that fixes your issue.

Jake-Shadle added a commit that referenced this issue Feb 17, 2021
srgothi92 added a commit to bottlerocket-os/bottlerocket-ecs-updater that referenced this issue Feb 17, 2021
Description:
cargo install cargo-deny was failing due to issue in downstream depndency
`funty` and `bitvec`.
cargo-deny issue [#331](EmbarkStudios/cargo-deny#331)
This change adds `--locked` to `cargo-deny` install so exact version specified in
`Cargo.lock` of `cargo-deny` is used to fetch dependency instead of skipping
minor version.
Jake-Shadle added a commit that referenced this issue Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants