Skip to content

cargo-0.15.0 --frozen: Why does it try to query the registry? All dependencies are available locally... #3476

Closed
@daym

Description

@daym

I'm trying to use cargo in an offline manner. For that, I'm trying to build c-vec using cargo build --frozen with the following (modified) Cargo.toml :

[package]
name = "c_vec"
version = "1.0.12"
authors = ["Guillaume Gomez <[email protected]>"]

description = "Structures to wrap C arrays"
repository = "https://github.com/GuillaumeGomez/c_vec-rs.git"
readme = "README.md"
keywords = ["c", "vec", "c_vec", "array"]
license = "Apache-2.0/MIT"

[lib]
name = "c_vec"

[dev-dependencies]
libc = "0.2.16"

[replace]
"libc:0.2.16" = { path = "/gnu/store/qi3fp02sdpc2pp3vjlv3szcvynfkwp1y-rust-libc-0.2.16/rustsrc" }

Where /gnu/store/qi3fp02sdpc2pp3vjlv3szcvynfkwp1y-rust-libc-0.2.16/rustsrc contains: Cargo.lock Cargo.toml src/ where Cargo.toml contains:

[package]

name = "libc"
version = "0.2.16"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang/libc"
homepage = "https://github.com/rust-lang/libc"
documentation = "http://doc.rust-lang.org/libc"
description = """
A library for types and bindings to native C functions often found in libc or
other common platform libraries.
"""

[features]
default = ["use_std"]
use_std = []

[replace]

and Cargo.lock contains:

[root]
name = "libc"
version = "0.2.16"

And still it's trying to get something from crates.io:

$ export RUST_LOG=debug
$ cargo build --frozen
DEBUG:cargo::build: executing; cmd=cargo-build; args=["cargo", "build", "--frozen"]
DEBUG:cargo::core::workspace: find_root - trying /x/home/dannym/x/rust-x/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /x/home/dannym/x/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /x/home/dannym/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /x/home/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /x/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Cargo.toml
DEBUG:cargo::core::workspace: find_members - only me as a member
DEBUG:cargo::core::registry: load/missing  file:///x/home/dannym/x/rust-x/ngry89bb50arnll7f6pgzn8xvdmmw3y5-rust-c-vec-1.1.0-checkout
DEBUG:cargo::sources::config: loading: file:///x/home/dannym/x/rust-x/ngry89bb50arnll7f6pgzn8xvdmmw3y5-rust-c-vec-1.1.0-checkout
DEBUG:cargo::core::resolver: initial activation: c_vec v1.0.12 (file:///x/home/dannym/x/rust-x/ngry89bb50arnll7f6pgzn8xvdmmw3y5-rust-c-vec-1.1.0-checkout)
DEBUG:cargo::core::registry: load/missing  registry https://github.com/rust-lang/crates.io-index
DEBUG:cargo::sources::config: loading: registry https://github.com/rust-lang/crates.io-index
DEBUG:cargo: handle_error; err=CliError { error: Some(ChainedError { error: failed to load source for a dependency on `libc`, cause: ChainedError { error: Unable to update registry https://github.com/rust-lang/crates.io-index, cause: attempting to make an HTTP request, but --frozen was specified } }), unknown: false, exit_code: 101 }
error: failed to load source for a dependency on `libc`

Caused by:
  Unable to update registry https://github.com/rust-lang/crates.io-index

Caused by:
  attempting to make an HTTP request, but --frozen was specified

Why?

Note that I installed a lock file manually for libc, too.

To give a little bit better overview - we're trying to integrate Rust into the Guix System Distribution. Guix has reproducible builds already so we'd rather if Cargo didn't load random things from the internet and just let us use our own packages.

For comparsion, when I allow it to query the registry, it will still not pick up the rust-libc from /gnu/store/qi3fp02sdpc2pp3vjlv3szcvynfkwp1y-rust-libc-0.2.16/rustsrc but rather the one from crates.io . I can't find out why using the debugging log above.

strace shows: When I use --frozen, it never tries to access /gnu/store/qi3fp02sdpc2pp3vjlv3szcvynfkwp1y-rust-libc-0.2.16/rustsrc . When I don't use --frozen it does access /gnu/store/qi3fp02sdpc2pp3vjlv3szcvynfkwp1y-rust-libc-0.2.16/rustsrc/src/lib.rs successfully.

So I'd say it's checking the replacements too late - among other things.

How can I debug this further?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions