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 traced back to old commit #105

Closed
terror opened this issue Feb 13, 2021 · 10 comments
Closed

Build failure traced back to old commit #105

terror opened this issue Feb 13, 2021 · 10 comments

Comments

@terror
Copy link

terror commented Feb 13, 2021

When building bitvec from source, I'm getting a build error and after running git bisect I could trace it back down to this commit -> 47d6e19

Here is the message I'm receiving

error[E0034]: multiple applicable items in scope
  --> src/mem.rs:28:19
   |
28 |     const INDX: u8 = Self::BITS.trailing_zeros() as u8;
   |                      ^^^^^^^^^^ multiple `BITS` found

OS: macOS Big Sur 10.16 20C69 x86_64
cargo --version: cargo 1.36.0 (c4fcfb725 2019-05-15)

Note that I'm using Big Sur which may play a role in the cause of this error.

@EthanYidong
Copy link

EthanYidong commented Feb 13, 2021

Actually, this is due to a breaking change in funty ferrilab/funty@b87325b, which ads a BITS constant that bitvec is glob importing. Version 1.1.0 of funty works fine, so as a temporary workaround, add funty = "=1.1.0" to your Cargo.toml

@Zorotic
Copy link

Zorotic commented Feb 14, 2021

Actually, this is due to a breaking change in funty myrrlyn/funty@b87325b, which ads a BITS constant that bitvec is glob importing. Version 1.1.0 of funty works fine, so as a temporary workaround, add funty = "=1.1.0" to your Cargo.toml

You are a live saver 💯

chifflier added a commit to rusticata/pcap-analyzer that referenced this issue Feb 14, 2021
Build fails due to a breaking change in funty (ferrilab/funty@b87325b),
which ads a BITS constant that bitvec is glob importing.
Version 1.1.0 of funty works fine, so as a temporary workaround, add
funty = "=1.1.0" to the Cargo.toml
See ferrilab/bitvec#105
agueganno added a commit to agueganno/biscuit-rust that referenced this issue Feb 14, 2021
It seems a transitive dependency of the project broke - bitvec - because
one of its own dependencies - funty - declared a global BITS const… hence breaking
the current project.

According to the bitvec project, a fix may be to force funty’s version
to 1.1.0.

The matching issue in bitvec :

ferrilab/bitvec#105
@mzhang28
Copy link

Maybe it would be a good idea to pin to minor versions of dependencies as well, since glob-imports are used in code?

alixinne added a commit to alixinne/tinygl that referenced this issue Feb 14, 2021
alixinne added a commit to alixinne/glsl-lang that referenced this issue Feb 14, 2021
Tiwalun added a commit to probe-rs/probe-rs that referenced this issue Feb 14, 2021
bors bot added a commit to probe-rs/probe-rs that referenced this issue Feb 14, 2021
546: Fix funty to version 1.1.0 to ensure bitvec compiles r=Yatekii a=Tiwalun

bitvec doesn't compile anymore, due to an update in the `funty` crate.
Fixing the `funty` version to 1.1.0 is a temporary workaround for this.

See ferrilab/bitvec#105.


Co-authored-by: Dominik Boehi <[email protected]>
@matthiasbeyer
Copy link

Maybe it would be a good idea to pin to minor versions of dependencies as well, since glob-imports are used in code?

I guess the proper way would not to use glob imports at all?

matthiasbeyer pushed a commit to science-computing/butido that referenced this issue Feb 15, 2021
This forces the transitive dependency of "bitvec", named "funty", to 1.1.0.
Rationale:

    ferrilab/bitvec#105 (comment)

Signed-off-by: Matthias Beyer <[email protected]>
@mzhang28
Copy link

mzhang28 commented Feb 15, 2021

Wait, I looked into it a bit and it doesn't look like a glob import; the problem is in src/mem.rs, the BitMemory trait is declaring an associated member called BITS:

const BITS: u8 = mem::size_of::<Self>() as u8 * 8;

But IsNumber which is a super-super-super-trait of BitMemory (indirectly through IsUnsigned and IsInteger), has been updated in version 1.2 of funty to include a BITS member as well, implementing the same functionality:

const BITS: u32;

Looks like both crates seem to just be waiting on the stabilization of the ::BITS member in the standard library, but for now, the rust compiler can't disambiguate between the two, so it raises the error.

First off, this won't happen if versions are pinned to at least minor version, since the semver specification allows minor versions to introduce new functionality into the public API:

Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards compatible functionality is introduced to the public API.

This means that if you don't pin to minor versions, your dependencies could cause collisions like what just happened. Since this is a library and not a bin, it can't take advantage of a lockfile so it should ideally pin to versions as exact as possible.

As for the actual problem, ultimately the decision is up to the maintainers but I think it'll be OK to depend on the IsNumber implementation since it's the same so there's not a need to reimplement it if depending on funty >=1.2.

The complication there would be the differences in the API (u8 vs. u32), which would probably require a major version bump for bitvec, but it'll be a major version bump either way since the BITS can't remain if IsNumber remains a supertrait. (or just never bump funty versions again)

@gui1117
Copy link

gui1117 commented Feb 25, 2021

can't we explicit usage of BITS in bitvec to avoid ambiguity ? #109

@gui1117
Copy link

gui1117 commented Feb 25, 2021

the above fix is based on 0.20, I open a fix for 0.20.1 #110

@myrrlyn
Copy link
Collaborator

myrrlyn commented Apr 18, 2021

I completely forgot to check up on this after publishing the patch releases, which is 100% my bad.

Is everyone fixed now

tarcieri added a commit to RustCrypto/traits that referenced this issue Apr 18, 2021
With this `bitvec` patch, we no longer need to pin `funty`:

ferrilab/bitvec#105
tarcieri added a commit to RustCrypto/traits that referenced this issue Apr 18, 2021
With this `bitvec` patch, we no longer need to pin `funty`:

ferrilab/bitvec#105
@tarcieri
Copy link

@myrrlyn yep, thanks!

@myrrlyn myrrlyn closed this as completed Apr 23, 2021
tazz4843 added a commit to tazz4843/scripty that referenced this issue Apr 29, 2021
ed255 added a commit to ed255/parity-scale-codec that referenced this issue Oct 29, 2021
There was a conflict between bitvec and a dependency of it (funty) that
caused a build failure. See:
- ferrilab/bitvec#105
- ferrilab/funty#3

Due to semver, when importing parity-scale-codec as a library adn
resolving bitvec 0.20.1 dependencies, funty 0.12 is pulled, which causes
the aforementioned build failure.  I believe this is not happening when
testing parity-scale-codec itself because Cargo.lock pins funty to
1.1.0, but when importing parity-scale-codec from another crate, this
pinning is sometimes not possible.  Bumping bitvec to 0.22.3 solves this
issue, as it is compatible with funty 0.12.
ed255 added a commit to ed255/parity-scale-codec that referenced this issue Oct 29, 2021
There was a conflict between bitvec and a dependency of it (funty) that
caused a build failure. See:
- ferrilab/bitvec#105
- ferrilab/funty#3

Due to semver, when importing parity-scale-codec as a library and
resolving bitvec 0.20.1 dependencies, funty 0.12 is pulled, which causes
the aforementioned build failure.  I believe this is not happening when
testing parity-scale-codec itself because Cargo.lock pins funty to
1.1.0, but when importing parity-scale-codec from another crate, this
pinning is sometimes not possible.  Bumping bitvec to 0.22.3 solves this
issue, as it is compatible with funty 0.12.
ed255 added a commit to ed255/parity-scale-codec that referenced this issue Oct 29, 2021
There was a conflict between bitvec and a dependency of it (funty) that
caused a build failure. See:
- ferrilab/bitvec#105
- ferrilab/funty#3

Due to semver, when importing parity-scale-codec as a library and
resolving bitvec 0.20.1 dependencies, funty 0.12 is pulled, which causes
the aforementioned build failure.  I believe this is not happening when
testing parity-scale-codec itself because Cargo.lock pins funty to
1.1.0, but when importing parity-scale-codec from another crate, this
pinning is sometimes not possible.  Bumping bitvec to 0.22.3 solves this
issue, as it is compatible with funty 0.12.
ed255 added a commit to ed255/parity-scale-codec that referenced this issue Oct 29, 2021
There was a conflict between bitvec and a dependency of it (funty) that
caused a build failure. See:
- ferrilab/bitvec#105
- ferrilab/funty#3

Due to semver, when importing parity-scale-codec as a library and
resolving bitvec 0.20.1 dependencies, funty 0.12 is pulled, which causes
the aforementioned build failure.  I believe this is not happening when
testing parity-scale-codec itself because Cargo.lock pins funty to
1.1.0, but when importing parity-scale-codec from another crate, this
pinning is sometimes not possible.  Bumping bitvec to 0.22.3 solves this
issue, as it is compatible with funty 0.12.
karim-agha added a commit to karim-agha/bellperson that referenced this issue May 27, 2022
algesten pushed a commit to webrtc-rs/webrtc that referenced this issue Aug 23, 2022
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

9 participants