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

Different crates with same name

Open leviska opened this issue 2 years ago • 3 comments

I have two dependencies in my crate:

entities = { path = "./entities" }
blockscout-db = { git = ".." } # same repo

and in blockscout-db there is also another crate named entities, which is different, than the first

When building with cargo, everything works fine, but cargo chef is failing, because it can't find some version

From the first look it seems connected to us having two crates with same name, but may be there is another reason

#18 [build 1/4] COPY . .
#18 DONE 0.0s

#19 [plan 2/2] RUN cargo chef prepare --recipe-path recipe.json
#19 DONE 0.1s

#20 [cache 1/2] COPY --from=plan /app/recipe.json recipe.json
#20 DONE 0.0s

#21 [cache 2/2] RUN cargo chef cook --release --recipe-path recipe.json
#21 0.289     Updating git repository `https://github.com/blockscout/blockscout-rs`
#21 1.[488](https://github.com/blockscout/blockscout-rs/actions/runs/3729863823/jobs/6326324512#step:8:490)     Updating crates.io index
#21 45.44     Updating git repository `[https://github.com/blockscout/actix-prost`](https://github.com/blockscout/actix-prost%60)
#21 45.76     Updating git submodule `[https://github.com/googleapis/googleapis.git`](https://github.com/googleapis/googleapis.git%60)
#21 53.26 error: failed to select a version for the requirement `entity = "*"` (locked to 0.0.1)
#21 53.26 candidate versions found which didn't match: 4.1.8, 0.1.0, 0.0.0
#21 53.26 location searched: Git repository https://github.com/blockscout/blockscout-rs#602c1b5d
#21 53.26 required by package `blockscout-db v4.1.8 (https://github.com/blockscout/blockscout-rs#602c1b5d)`
#21 53.26     ... which satisfies git dependency `blockscout-db` (locked to 4.1.8) of package `stats v0.0.1 (/app/stats)`
#21 53.27 thread 'main' panicked at 'Exited with status code: 101', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/cargo-chef-0.1.47/src/recipe.rs:176:27
#21 53.27 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#21 ERROR: process "/bin/sh -c cargo chef cook --release --recipe-path recipe.json" did not complete successfully: exit code: 101
------
 > [cache 2/2] RUN cargo chef cook --release --recipe-path recipe.json:

#21 45.44     Updating git repository `[https://github.com/blockscout/actix-prost`](https://github.com/blockscout/actix-prost%60)
#21 45.76     Updating git submodule `[https://github.com/googleapis/googleapis.git`](https://github.com/googleapis/googleapis.git%60)
#21 53.26 error: failed to select a version for the requirement `entity = "*"` (locked to 0.0.1)
#21 53.26 candidate versions found which didn't match: 4.1.8, 0.1.0, 0.0.0
#21 53.26 location searched: Git repository https://github.com/blockscout/blockscout-rs#602c1b5d
#21 53.26 required by package `blockscout-db v4.1.8 (https://github.com/blockscout/blockscout-rs#602c1b5d)`
#21 53.26     ... which satisfies git dependency `blockscout-db` (locked to 4.1.8) of package `stats v0.0.1 (/app/stats)`
#21 53.27 thread 'main' panicked at 'Exited with status code: 101', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/cargo-chef-0.1.47/src/recipe.rs:176:27
#21 53.27 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
------
Dockerfile:30
--------------------
  28 |     FROM chef as cache
  29 |     COPY --from=plan /app/recipe.json recipe.json
  30 | >>> RUN cargo chef cook --release --recipe-path recipe.json
  31 |     
  32 |     FROM chef AS build
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo chef cook --release --recipe-path recipe.json" did not complete successfully: exit code: 101

The full log is available here

The github ci is here

And the workspace being built is here, while the blockscout-db is here

leviska avatar Dec 19 '22 19:12 leviska

This isn't very critical for us, so if there is an easy fix, I could may be help, but if there isn't, may be just keep this issue open until more people will struggle with it or somebody will fix it

leviska avatar Dec 19 '22 19:12 leviska

@leviska Did that PR fix the problem? (=> Was it due to the crates having the same name?)

memark avatar Jan 01 '23 20:01 memark

Yes, we've renamed the crates and everything worked

leviska avatar Jan 03 '23 17:01 leviska

This should have been solved for good by #247.

LukeMathWalker avatar Feb 27 '24 08:02 LukeMathWalker