Version
v1.0.0-alpha.0
Platform
The output of uname -a (UNIX), or version and 32 or 64-bit (Windows)
$ uname -a
Linux myhost 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Description
I tried this: cargo build --locked
I expected to see this happen: A build would proceed with the committed Cargo.lock unmodified.
Instead, this happened: Cargo complains that the lockfile needs to be updated.
Is this just my misunderstanding?
Does --locked mean "if any dependencies have been updated while still meeting the version constraints, then fail to build`? It might mean that, but that seems weird to me. I assumed it meant: "Build using the exact dependencies in the lock file even if there are newer releases that would meet the version constraints."
I also tried --frozen, but that fails to fetch any dependencies.
Minimal transcript:
/tmp$ git clone -q 'https://github.com/ZcashFoundation/zebra'
/tmp$ cd zebra/
/tmp/zebra$ git checkout -q v1.0.0-alpha.0
/tmp/zebra$ git describe
v1.0.0-alpha.0
/tmp/zebra$ cargo build --locked
Updating crates.io index
error: the lock file /tmp/zebra/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, use the --offline flag.
When I examine the lockfile diff I seems immediately relevant to https://github.com/ZcashFoundation/zebra/issues/1494 :
diff --git a/Cargo.lock b/Cargo.lock
index c7f769f9..99e86e1c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3142,7 +3142,7 @@ dependencies = [
[[package]]
name = "zebra-chain"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
dependencies = [
"bech32",
"bincode",
@@ -3180,11 +3180,11 @@ dependencies = [
[[package]]
name = "zebra-client"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
[[package]]
name = "zebra-consensus"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
dependencies = [
"chrono",
"color-eyre",
@@ -3215,7 +3215,7 @@ dependencies = [
[[package]]
name = "zebra-network"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
dependencies = [
"bitflags",
"byteorder",
@@ -3243,11 +3243,11 @@ dependencies = [
[[package]]
name = "zebra-rpc"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
[[package]]
name = "zebra-script"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
dependencies = [
"displaydoc",
"hex",
@@ -3260,7 +3260,7 @@ dependencies = [
[[package]]
name = "zebra-state"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
dependencies = [
"chrono",
"color-eyre",
@@ -3289,7 +3289,7 @@ dependencies = [
[[package]]
name = "zebra-test"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
dependencies = [
"color-eyre",
"futures",
@@ -3311,7 +3311,7 @@ dependencies = [
[[package]]
name = "zebra-utils"
-version = "3.0.0-alpha.0"
+version = "1.0.0-alpha.0"
dependencies = [
"color-eyre",
"hex",
When I examine the lockfile diff I seems immediately relevant to #1494 :
Zebra's crates aren't published to crates.io, and you have v1.0.0-alpha.0 checked out, so cargo shouldn't be able to see these version changes.
cargo buildI can reproduce the error you get using cargo build --locked.
Try these commands instead:
$ git clone -q 'https://github.com/ZcashFoundation/zebra'
$ cd zebra/
$ git checkout -q v1.0.0-alpha.0
$ cargo fetch
$ cargo build --frozen
So there doesn't seem to be any particular issue in Zebra.
I just think the cargo documentation and error messages are unclear.
If you keep having issues, try ignoring any cached cargo state and configs:
export CARGO_HOME=$(mktemp -d)
Then build zebrad using the commands above.
cargo install or plain cargo buildSince this is all a bit complicated, we encourage people to install a zebrad release using:
cargo install --locked --git https://github.com/ZcashFoundation/zebra --tag v1.0.0-alpha.0 zebrad
https://github.com/ZcashFoundation/zebra#detailed-build-and-run-instructions
Or you can build zebrad with the latest dependencies using:
cargo build
Thank you for the clear explanation. So it sounds like I assumed that:
cargo build --locked
-would do what in actually is accomplished by:
cargo fetch
cargo build --frozen
Thanks!
Most helpful comment
Building a release using
cargo buildI can reproduce the error you get using
cargo build --locked.Try these commands instead:
So there doesn't seem to be any particular issue in Zebra.
I just think the
cargodocumentation and error messages are unclear.Ignoring cargo configs and state
If you keep having issues, try ignoring any cached cargo state and configs:
Then build
zebradusing the commands above.Using
cargo installor plaincargo buildSince this is all a bit complicated, we encourage people to install a
zebradrelease using:https://github.com/ZcashFoundation/zebra#detailed-build-and-run-instructions
Or you can build
zebradwith the latest dependencies using: