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

Cargo update for locked install #337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kushudai
Copy link

@kushudai kushudai commented Dec 8, 2024

I cannot install addr2line with cargo with the locked flag. It works without the locked flag.

cargo install addr2line --locked
    Updating crates.io index
  Installing addr2line v0.24.2
    Updating crates.io index
error: failed to select a version for `addr2line`.
    ... required by package `backtrace v0.3.74`
    ... which satisfies dependency `backtrace = "^0.3.13"` (locked to 0.3.74) of package `addr2line v0.24.2`
versions that meet the requirements `^0.24.0` (locked to 0.24.1) are: 0.24.1

all possible versions conflict with previously selected packages.

  previously selected package `addr2line v0.24.2`

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

This attempts to fix it by getting the lock file to be in sync with what cargo thinks it should use by running cargo update on the repo.

Fixes #338

@kushudai
Copy link
Author

kushudai commented Dec 8, 2024

Hi @philipc Could I trouble you to take a look at this PR?
I opened a corresponding issue as well (I apologize if that wasn't the correct etiquette, I wasn't sure)

@philipc
Copy link
Contributor

philipc commented Dec 9, 2024

Thanks for the PR. I can reproduce this issue but I don't understand why it is happening. If I download the crate from https://crates.io/api/v1/crates/addr2line/0.24.2/download and build with cargo build --features bin --locked it works without error. So I doubt this PR will fix the problem for the next time we do an addr2line release.

@kushudai
Copy link
Author

kushudai commented Dec 9, 2024

Thanks for the PR. I can reproduce this issue but I don't understand why it is happening. If I download the crate from https://crates.io/api/v1/crates/addr2line/0.24.2/download and build with cargo build --features bin --locked it works without error. So I doubt this PR will fix the problem for the next time we do an addr2line release.

Yeah, I think you are right. I was naive.
So it seems cargo install tries to also pull in dev-dependencies which pulls in backtrace-rs which itself depends on addr2line on non windows targets.m https://github.com/rust-lang/backtrace-rs/blob/26ab4afa46e889f2f4c81e5f5022f61569f02d16/Cargo.toml#L47
I'm confused why cargo install is pulling in dev dependencies though.

@philipc
Copy link
Contributor

philipc commented Dec 10, 2024

Yeah it doesn't even build backtrace when you install without the --locked, so it shouldn't need to be checking these dependencies, and cargo +nightly -Z avoid-dev-deps doesn't fix the problem either. I think this is a cargo bug. We could possibly work around it by moving some tests into another crate in the workspace.

@kushudai
Copy link
Author

Thanks for your insights @philipc, I went ahead and opened an issue on cargo rust-lang/cargo#14937

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

Successfully merging this pull request may close these issues.

cargo install --locked does not work.
2 participants