Skip to content

"cargo build" fails to select version for new dependency on first run #8249

@M1cha

Description

@M1cha

Problem
On the first run, cargo fails to select a version. on any following run it succeeds.

    Updating crates.io index
error: failed to select a version for `openblas-src`.
    ... required by package `blas-src v0.2.1`
    ... which is depended on by `ndarray v0.13.1`
    ... which is depended on by `ndarray-linalg v0.12.0`
    ... which is depended on by `verbug v0.1.0 (/tmp/verbug)`
versions that meet the requirements `^0.6` are: 0.6.1, 0.6.0

the package `openblas-src` links to the native library `openblas`, but it conflicts with a previous package which links to `openblas` as well:
package `openblas-src v0.9.0`
    ... which is depended on by `verbug v0.1.0 (/tmp/verbug)`

failed to select a version for `openblas-src` which could resolve this conflict

Steps

  1. clone https://github.com/M1cha/rust-verbug
  2. cargo build - this will fail
  3. cargo build - this will succeed

if you want to create your own project:

  1. create a new (binary) project
  2. add these dependencies:
blas-src = { version = "*", features = ["openblas"] }
openblas-src = { version = "*", features = ["static"] }
  1. cargo build
  2. add this dependency: ndarray-linalg = "0.12"
  3. cargo build - this will fail
  4. cargo build - this will succeed

Notes
You don't have to actually finish building. the part where cargo regenerates Cargo.lock is important. (building openblas takes a long time)

Output of cargo version:
cargo 1.43.0 (2cbe904 2020-05-03), installed using rustup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dependency-resolutionArea: dependency resolution and the resolverA-lockfileArea: Cargo.lock issuesC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions