Skip to content

cargo cannot use gerrit for git dependencies #16767

@jonathanpallant

Description

@jonathanpallant

Problem

As per https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/can.E2.80.99t.20use.20dependencies.20from.20gerrit.3F/with/580420299, cargo cannot checkout a git repo stored as a gerrit change request. It see

With a dependency like:

arm-fvp-base-pac = { git = "https://review.trustedfirmware.org/arm-firmware-crates/arm-fvp-base-pac", rev = "refs/changes/45/49345/2", default-features = false, features = [
    "swapped-memory-layout",
] }

cargo will print:

$ cargo build
error: failed to get `arm-fvp-base-pac` as a dependency of package `armv8-r v0.0.0 (/Users/jonathan/Documents/aarch64-cpu/examples/armv8-r)`

Caused by:
  failed to load source for dependency `arm-fvp-base-pac`

Caused by:
  unable to update https://review.trustedfirmware.org/arm-firmware-crates/arm-fvp-base-pac?rev=refs%2Fchanges%2F45%2F49345%2F2#4b1c2512

Caused by:
  failed to fetch into: /Users/jonathan/.cargo/git/db/arm-fvp-base-pac-bc588fcbfc49ed02

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  unexpected return value from ssl handshake -9836; class=Ssl (16)

I have been able to 'trick' cargo into working by removing Cargo.lock, and replacing the dependency with:

arm-fvp-base-pac = { git = "https://review.trustedfirmware.org/arm-firmware-crates/arm-fvp-base-pac" }

Note, no rev =, and no features = (because the main branch doesn't have that feature). With this dependency it will build, but we're using the wrong version of the library. Now restore the dependency as it was, and it will work! I think this is because the git checkout in .cargo now has some information in it that is missing when rev = "..." is specified. I don't fully understand why though.

Steps

git clone https://github.com/rust-embedded/aarch64-cpu
cd aarch64-cpu
git checkout f868d61fd04e49ae9a5bbcaa024f4a75cc83e4a0
cd examples/armv8-r
cargo build

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.95.0-nightly (ce69df6f7 2026-02-12)

Metadata

Metadata

Assignees

Labels

A-gitArea: anything dealing with gitC-bugCategory: bugS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions