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

"rerun-if-changed" in build script causes causes fingerprint error and extra rebuild #2261

Closed
mbrubeck opened this issue Jan 4, 2016 · 4 comments

Comments

@mbrubeck
Copy link
Contributor

mbrubeck commented Jan 4, 2016

If a dependency contains the following build script:

fn main() { println!("cargo:rerun-if-changed=build.rs"); }

Then running cargo build twice in a row compile the dependency twice, instead of just once:

$ cargo build
   Compiling a v0.1.0 (file:///home/mbrubeck/src/test/cargotest)
   Compiling cargotest v0.1.0 (file:///home/mbrubeck/src/test/cargotest)
$ cargo build
   Compiling a v0.1.0 (file:///home/mbrubeck/src/test/cargotest)
   Compiling cargotest v0.1.0 (file:///home/mbrubeck/src/test/cargotest)
$ cargo build
$ 

Possibly related: the following message appears in the log output during the second build, but not the first or third build:

INFO:cargo::ops::cargo_rustc::fingerprint: fingerprint error for a v0.1.0 (file:///home/mbrubeck/src/test/cargotest): local fingerprint type has changed

As reported by @cdlm on IRC, this affects the current version of the glutin crate. And here is a minimal test case for this issue: https://github.com/mbrubeck/cargotest

@mbrubeck mbrubeck changed the title "rerun-if-changed" in build script causes causes fingerprint error and extra rebuild "rerun-if-changed=build.rs" in build script causes causes fingerprint error and extra rebuild Jan 4, 2016
@mbrubeck mbrubeck changed the title "rerun-if-changed=build.rs" in build script causes causes fingerprint error and extra rebuild "rerun-if-changed" in build script causes causes fingerprint error and extra rebuild Jan 4, 2016
@mbrubeck
Copy link
Contributor Author

mbrubeck commented Jan 4, 2016

cc #2134

@alexcrichton
Copy link
Member

Note that you don't need to depend on the build script's source to re-trigger compiling the build script, Cargo does that automatically. That being said this probably shouldn't happen either way, so there may still be a bug.

@mbrubeck
Copy link
Contributor Author

This happens for any value of rerun-if-changed. For example, cargo:rerun-if-changed=src/lib.rs triggers the same issue.

@alexcrichton
Copy link
Member

Fixed by #2279

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

No branches or pull requests

2 participants