Problem
Repeat cargo build , it rebuild sometimes. For example, wait for 20s between two build requests, it probably will rebuild.
Steps
- A hello world project, with a dependency.
- run
cargo build
project is build without any error.
-
Wait for 10s ~ 20s
-
run cargo build again
-
see the build result, project rebuild again
-
if not rebuild, try cargo build again later
Possible Solution(s)
Notes
Output of cargo version:
cargo:
cargo 1.39.0 (1c6ec66d5 2019-09-30)
os:
Microsoft Windows [Version 10.0.18362.476]
toolchain:
stable-i686-pc-windows-msvc
stable-x86_64-pc-windows-msvc (default)
rustc:
rustc 1.39.0 (4560ea788 2019-11-04)
output with
D:\project\rust\hello>cargo build
[2019-12-10T08:47:28Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: D:\project\rust\hello\target\debug\.fingerprint\hello-0d49ef5d0be49544\bin-hello-0d49ef5d0be49544
[2019-12-10T08:47:28Z DEBUG cargo::core::compiler::fingerprint] old local fingerprints deps
[2019-12-10T08:47:28Z INFO cargo::core::compiler::fingerprint] stale: changed "D:\\project\\rust\\hello\\src\\main.rs"
[2019-12-10T08:47:28Z INFO cargo::core::compiler::fingerprint] (vs) "D:\\project\\rust\\hello\\target\\debug\\.fingerprint\\hello-0d49ef5d0be49544\\dep-bin-hello-0d49ef5d0be49544"
[2019-12-10T08:47:28Z INFO cargo::core::compiler::fingerprint] FileTime { seconds: 13220441240, nanos: 504682200 } != FileTime { seconds: 13220441243, nanos: 338750900 }
[2019-12-10T08:47:28Z INFO cargo::core::compiler::fingerprint] fingerprint error for hello v0.1.0 (D:\project\rust\hello)/Build/Target { name: "hello", doc: true, ..: with_path("D:\\project\\rust\\hello\\src\\main.rs", Edition2018) }
[2019-12-10T08:47:28Z INFO cargo::core::compiler::fingerprint] err: current filesystem status shows we're outdated
[2019-12-10T08:47:28Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: D:\project\rust\hello\target\debug\.fingerprint\serde-8e9540ce95d30679\lib-serde-8e9540ce95d30679
[2019-12-10T08:47:28Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: D:\project\rust\hello\target\debug\.fingerprint\serde-943ea1ad745afc66\run-build-script-build_script_build-943ea1ad745afc66
[2019-12-10T08:47:28Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: D:\project\rust\hello\target\debug\.fingerprint\serde-5f92802e6d14b992\build-script-build_script_build-5f92802e6d14b992
Compiling hello v0.1.0 (D:\project\rust\hello)
[2019-12-10T08:47:28Z DEBUG cargo::core::compiler::fingerprint] write fingerprint (bce88c867730445f) : D:\project\rust\hello\target\debug\.fingerprint\hello-0d49ef5d0be49544\bin-hello-0d49ef5d0be49544
Finished dev [unoptimized + debuginfo] target(s) in 0.57s
D:\project\rust\hello>cargo build
[2019-12-10T08:47:30Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: D:\project\rust\hello\target\debug\.fingerprint\hello-0d49ef5d0be49544\bin-hello-0d49ef5d0be49544
[2019-12-10T08:47:30Z DEBUG cargo::core::compiler::fingerprint] old local fingerprints deps
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] fingerprint error for hello v0.1.0 (D:\project\rust\hello)/Build/Target { name: "hello", doc: true, ..: with_path("D:\\project\\rust\\hello\\src\\main.rs", Edition2018) }
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] err: unit dependency information changed
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] cause: new (serde/61d371068b15ded9) != old (serde/4da49df1afa923c9)
[2019-12-10T08:47:30Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: D:\project\rust\hello\target\debug\.fingerprint\serde-8e9540ce95d30679\lib-serde-8e9540ce95d30679
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] fingerprint error for serde v1.0.103/Build/Target { ..: lib_target("serde", ["lib"], "C:\\Users\\Frank Long\\.cargo\\registry\\src\\gitlab.com-5c4dd09064763be6\\serde-1.0.103\\src\\lib.rs", Edition2015) }
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] err: path to the compiler has changed
[2019-12-10T08:47:30Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: D:\project\rust\hello\target\debug\.fingerprint\serde-943ea1ad745afc66\run-build-script-build_script_build-943ea1ad745afc66
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] fingerprint error for serde v1.0.103/RunCustomBuild/Target { ..: custom_build_target("build-script-build", "C:\\Users\\Frank Long\\.cargo\\registry\\src\\gitlab.com-5c4dd09064763be6\\serde-1.0.103\\build.rs", Edition2015) }
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] err: unit dependency information changed
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] cause: new (build_script_build/d91329d12c3f6836) != old (build_script_build/55c509b8e1b25cbb)
[2019-12-10T08:47:30Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: D:\project\rust\hello\target\debug\.fingerprint\serde-5f92802e6d14b992\build-script-build_script_build-5f92802e6d14b992
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] fingerprint error for serde v1.0.103/Build/Target { ..: custom_build_target("build-script-build", "C:\\Users\\Frank Long\\.cargo\\registry\\src\\gitlab.com-5c4dd09064763be6\\serde-1.0.103\\build.rs", Edition2015) }
[2019-12-10T08:47:30Z INFO cargo::core::compiler::fingerprint] err: path to the compiler has changed
Compiling serde v1.0.103
[2019-12-10T08:47:30Z DEBUG cargo::core::compiler::fingerprint] write fingerprint (d91329d12c3f6836) : D:\project\rust\hello\target\debug\.fingerprint\serde-5f92802e6d14b992\build-script-build_script_build-5f92802e6d14b992
[2019-12-10T08:47:30Z DEBUG cargo::core::compiler::fingerprint] write fingerprint (6fb3b4b1c6eec27) : D:\project\rust\hello\target\debug\.fingerprint\serde-943ea1ad745afc66\run-build-script-build_script_build-943ea1ad745afc66
[2019-12-10T08:47:39Z DEBUG cargo::core::compiler::fingerprint] write fingerprint (61d371068b15ded9) : D:\project\rust\hello\target\debug\.fingerprint\serde-8e9540ce95d30679\lib-serde-8e9540ce95d30679
Compiling hello v0.1.0 (D:\project\rust\hello)
[2019-12-10T08:47:39Z DEBUG cargo::core::compiler::fingerprint] write fingerprint (d83b09c3bda6217) : D:\project\rust\hello\target\debug\.fingerprint\hello-0d49ef5d0be49544\bin-hello-0d49ef5d0be49544
Finished dev [unoptimized + debuginfo] target(s) in 9.56s
- Windows system process still update the file under build directory after cargo process exit

Problem
Repeat
cargo build, it rebuild sometimes. For example, wait for 20s between two build requests, it probably will rebuild.Steps
cargo buildproject is build without any error.
Wait for 10s ~ 20s
run
cargo buildagainsee the build result, project rebuild again
if not rebuild, try
cargo buildagain laterPossible Solution(s)
Notes
Output of
cargo version:output with