cargo-bitbake icon indicating copy to clipboard operation
cargo-bitbake copied to clipboard

`cargo bitbake` doesn't work for packages which depend on env_logger...

Open mortie opened this issue 1 year ago • 4 comments

Running cargo bitbake in a project which depends on env_logger (at least version 0.11.5) produces this error:

error: failed to select a version for `env_logger`.
    ... required by package `example-project v0.1.0 (/Users/martin/example-project)`
versions that meet the requirements `^0.11.5` are: 0.11.5

the package `example-project` depends on `env_logger`, with features: `anstream` but `env_logger` does not have these features.
 It has an optional dependency with that name, but but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.


failed to select a version for `env_logger` which could resolve this conflict
Here are full repro steps
pro ~ $ mkdir example-project
pro ~ $ cd example-project
pro ~/example-project $ cargo init
     Created binary (application) package
pro ~/example-project main $ cargo add env_logger
    Updating crates.io index
      Adding env_logger v0.11.5 to dependencies.
             Features:
             + auto-color
             + color
             + humantime
             + regex
             - unstable-kv
    Updating crates.io index
pro ~/example-project main $ cargo build
   Compiling memchr v2.7.4
   Compiling regex-syntax v0.8.4
   Compiling utf8parse v0.2.2
   Compiling log v0.4.22
   Compiling is_terminal_polyfill v1.70.1
   Compiling anstyle-query v1.1.1
   Compiling anstyle v1.0.8
   Compiling colorchoice v1.0.2
   Compiling humantime v2.1.0
   Compiling anstyle-parse v0.2.5
   Compiling anstream v0.6.15
   Compiling aho-corasick v1.1.3
   Compiling regex-automata v0.4.7
   Compiling regex v1.10.6
   Compiling env_filter v0.1.2
   Compiling env_logger v0.11.5
   Compiling example-project v0.1.0 (/Users/martin/example-project)
    Finished dev [unoptimized + debuginfo] target(s) in 2.32s
pro ~/example-project main $ ./target/debug/example-project
Hello, world!
pro ~/example-project main $ cargo bitbake
error: failed to select a version for `env_logger`.
    ... required by package `example-project v0.1.0 (/Users/martin/example-project)`
versions that meet the requirements `^0.11.5` are: 0.11.5

the package `example-project` depends on `env_logger`, with features: `anstream` but `env_logger` does not have these features.
 It has an optional dependency with that name, but but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.


failed to select a version for `env_logger` which could resolve this conflict

mortie avatar Sep 14 '24 14:09 mortie

Hello, I am experiencing the same problem; I've replicated the repro steps and followed the commits of both Oct 18 and Jan 8 and used the rust and cargo version 1.80 but it still doesn't work, providing this error message:

error: failed to select a version for `env_logger`.
    ... required by package `example_project v0.1.0 (/home/usr/projects/example_project)`
versions that meet the requirements `^0.11` are: 0.11.7

the package `quantum-manager` depends on `env_logger`, with features: `anstream` but `env_logger` does not have these features.
 It has an optional dependency with that name, but but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.


failed to select a version for `env_logger` which could resolve this conflict

Any help, please? Thank you

MirkoDonnarumma avatar Mar 17 '25 08:03 MirkoDonnarumma

@MirkoDonnarumma Unfortunately the cargo-bitbake maintainers haven't made a new crates.io release yet, so the version you're running is basically obsolete. You can install the latest git revision by doing cargo install --git https://github.com/meta-rust/cargo-bitbake.git

paolobarbolini avatar Mar 17 '25 08:03 paolobarbolini

I run in the same error...

mtows avatar May 20 '25 12:05 mtows

@paolobarbolini thank you for the explanation, even in doing so (as I can remember) it didn't fix the problem. I ended up removing env_logger for the moment, as it's not in priority.

As for what I understood, anstream is just a crate for writing colored text to a terminal. That being said, I tried different options, such as trying to use ansi_term and even doing something as such:

[dependencies]
env_logger = { version = "0.11.8", default-features = false }

[features]
anstream = ["env_logger/ansi_term"]

But it didn't work. I am out of ideas and for now I won't lose anymore time on this problem.

@mtows I hope someone else can resolve this in the future.

In the meantime, happy coding fellas.

MirkoDonnarumma avatar May 21 '25 09:05 MirkoDonnarumma