Skip to content

cargo install fails when package uses previous version of its own to build itself #11999

Closed
@phorward

Description

Problem

Hello!

My package tokay uses a previous version of its own to build itself. It worked until Rust toolchain 1.67.1, but since 1.68.0 this is broken and I cannot find a solution for it.

Here's what happens with Rust toolchain 1.68.2 (stable):

$ cargo install -v tokay
    Updating crates.io index
  Installing tokay v0.6.2
error: failed to compile `tokay v0.6.2`, intermediate artifacts can be found at `/tmp/cargo-installVvDECK`

Caused by:
  There are multiple `tokay` packages in your project, and the specification `tokay` is ambiguous.
  Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
    tokay@0.4.0
    tokay@0.6.2

The provided hint doesn't help as well, because I cannot specify -p tokay@0.6.2 together with cargo install, as its probably a cargo build command.

As written, tokay uses a previous version of its own as build-dependency, and also in dependency of a dependency.
Therefore, to build tokay 0.6.2, tokay 0.4.0 is required by build.rs and by tokay-macros.

Here are the dependencies as specified in Cargo.toml:

[package]
name = "tokay"
version = "0.6.2"
edition = "2021"

[build-dependencies]
tokay = "0.4"
glob = "0.3"

[dependencies]
charclass = "0.2"  # use crates.io-version
clap = { version = "4", features = ["derive"] }
indexmap = "1.9"
num = "0.4"
num-bigint = "0.4"
rustyline = "9"
tokay-macros = "0.4"  # use crates.io-version
num-parse = "0.1"  # use crates.io-version

Steps

cargo install tokay

Possible Solution(s)

I don't have any solutions for this problem.

I've tried to use another name for the older package version in the build dependencies, but this also didn't work.

[build-dependencies]
tokay_04 = { package = "tokay", version = "0.4" }
glob = "0.3"

I haven't tried it in the tokay-macros package as well, as I first have to publish this packages, and tokay afterwards, just to test it.

Notes

When I run cargo build or cargo run in my checked out repository, all works as expected, also with the newest 1.68 toolchain.

Thanks for any help!

Version

cargo 1.68.2 (6feb7c9cf 2023-03-26)
release: 1.68.2
commit-hash: 6feb7c9cfc0c5604732dba75e4c3b2dbea38e8d8
commit-date: 2023-03-26
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:OpenSSL/1.1.1q)
os: Arch Linux [64-bit]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewregression-from-stable-to-stableRegression in stable that worked in a previous stable release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions