BLAKE3-team / BLAKE3

the official Rust and C implementations of the BLAKE3 cryptographic hash function
Apache License 2.0
4.67k stars 312 forks source link

Continual recompliation of blake3 #324

Open justinabrahms opened 11 months ago

justinabrahms commented 11 months ago

Blake3 is in my transitive dependency chain. When I edit my code, it recompiles every time. It seems to believe that the environment variable is changing.. but I'm just editing a file, nothing more.

Most seemingly relevant line below.

[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: EnvVarChanged { name: "CC", old_value: None, new_value: Some("gcc") }

Thoughts?

$ CARGO_LOG=cargo::core::compiler::fingerprint=info cargo build
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] dependency on `build_script_build` is newer than we are 1689140428.554280381s > 1689140320.333216314s "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blake3-1.4.0"
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for WORK_CODE v0.1.0 (/home/abrahms/src/github.com/subconsciousnetwork/WORK_CODE)/Build/TargetInner { name: "WORK_PACKAGE", doc: true, ..: with_path("/home/abrahms/src/github.com/subconsciousnetwork/WORK_CODE/src/main.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for cid v0.10.1/Build/TargetInner { ..: lib_target("cid", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cid-0.10.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "multihash", old_fingerprint: 5789376448465686996, new_name: "multihash", new_fingerprint: 15717749769461962212 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for multihash v0.18.1/Build/TargetInner { ..: lib_target("multihash", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/multihash-0.18.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "blake3", old_fingerprint: 11447239697517040600, new_name: "blake3", new_fingerprint: 9816954190456901003 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for blake3 v1.4.0/Build/TargetInner { ..: lib_target("blake3", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blake3-1.4.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "build_script_build", old_fingerprint: 13742670213903239432, new_name: "build_script_build", new_fingerprint: 991342934240953990 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for blake3 v1.4.0/RunCustomBuild/TargetInner { ..: custom_build_target("build-script-build", "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blake3-1.4.0/build.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: EnvVarChanged { name: "CC", old_value: None, new_value: Some("gcc") }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for libipld v0.16.0/Build/TargetInner { ..: lib_target("libipld", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libipld-0.16.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "libipld_json", old_fingerprint: 17084127054727942497, new_name: "libipld_json", new_fingerprint: 5921226181653514756 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for libipld-cbor v0.16.0/Build/TargetInner { ..: lib_target("libipld-cbor", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libipld-cbor-0.16.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "libipld_core", old_fingerprint: 13071416919958757996, new_name: "libipld_core", new_fingerprint: 17725040881794123426 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for libipld-core v0.16.0/Build/TargetInner { ..: lib_target("libipld-core", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libipld-core-0.16.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for libipld-json v0.16.0/Build/TargetInner { ..: lib_target("libipld-json", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libipld-json-0.16.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "libipld_core", old_fingerprint: 13071416919958757996, new_name: "libipld_core", new_fingerprint: 17725040881794123426 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for libipld-macro v0.16.0/Build/TargetInner { ..: lib_target("libipld-macro", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libipld-macro-0.16.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "libipld_core", old_fingerprint: 13071416919958757996, new_name: "libipld_core", new_fingerprint: 17725040881794123426 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for libipld-pb v0.16.0/Build/TargetInner { ..: lib_target("libipld-pb", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libipld-pb-0.16.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "libipld_core", old_fingerprint: 13071416919958757996, new_name: "libipld_core", new_fingerprint: 17725040881794123426 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere-api v0.9.1/Build/TargetInner { ..: lib_target("noosphere-api", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-api-0.9.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere-car v0.2.0/Build/TargetInner { ..: lib_target("noosphere-car", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-car-0.2.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere-core v0.13.1/Build/TargetInner { ..: lib_target("noosphere-core", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-core-0.13.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere-collections v0.6.1/Build/TargetInner { ..: lib_target("noosphere-collections", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-collections-0.6.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere-storage v0.7.1/Build/TargetInner { ..: lib_target("noosphere-storage", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-storage-0.7.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for ucan v0.4.0/Build/TargetInner { ..: lib_target("ucan", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ucan-0.4.0/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for ucan-key-support v0.1.7/Build/TargetInner { ..: lib_target("ucan-key-support", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ucan-key-support-0.1.7/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "ucan", old_fingerprint: 14090303343170715210, new_name: "ucan", new_fingerprint: 9002932740954988695 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for dummy-ns v0.1.0 (/home/abrahms/src/github.com/subconsciousnetwork/WORK_CODE2)/Build/TargetInner { name: "dummy-ns", doc: true, ..: with_path("/home/abrahms/src/github.com/subconsciousnetwork/WORK_CODE2/src/main.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere-ns v0.9.1/Build/TargetInner { ..: lib_target("noosphere-ns", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-ns-0.9.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere v0.12.1/Build/TargetInner { ..: lib_target("noosphere", ["rlib", "staticlib", "cdylib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-0.12.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere-sphere v0.7.1/Build/TargetInner { ..: lib_target("noosphere-sphere", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-sphere-0.7.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint] fingerprint dirty for noosphere-ipfs v0.6.1/Build/TargetInner { ..: lib_target("noosphere-ipfs", ["lib"], "/home/abrahms/.cargo/registry/src/index.crates.io-6f17d22bba15001f/noosphere-ipfs-0.6.1/src/lib.rs", Edition2021) }
[2023-07-12T05:41:37Z INFO  cargo::core::compiler::fingerprint]     dirty: UnitDependencyInfoChanged { old_name: "cid", old_fingerprint: 2196727044934558216, new_name: "cid", new_fingerprint: 7776841732667268909 }
max-niederman commented 7 months ago

I'm also having this issue.

oconnor663 commented 7 months ago

build.rs contains these lines, which might be related:

    // The `cc` crate doesn't automatically emit rerun-if directives for the
    // environment variables it supports, in particular for $CC. We expect to
    // do a lot of benchmarking across different compilers, so we explicitly
    // add the variables that we're likely to need.
    println!("cargo:rerun-if-env-changed=CC");
    println!("cargo:rerun-if-env-changed=CFLAGS");

I'd be curious if removing those lines fixes the issue for you. That wouldn't tell us the whole story, but it would be a big part. Also, can you reproduce this issue in any open source project that I could also build for myself. It would help to see it happen on my own machine.

max-niederman commented 7 months ago

Yeah, it's almost certainly to do with those rerun directives.

I was messing around with it earlier and I did notice that it only ever happens in my VS Code terminal, which is quite weird. There are a lot of moving parts w.r.t. the terminal in my particular project because I'm using a Nix shell w/ Direnv, so it's going to be a bit difficult to track down the issue, but I'll set aside some time tomorrow to work on a minimal reproduction.

pyranota commented 3 months ago

I have similar problem on Voidlinux. But with small difference: dirty: EnvVarChanged { name: "CC", old_value: Some("gcc"), new_value: None }. I found a workaround for this. In my case worked exporting CC and AR manually:

  1. export CC=gcc
  2. export AR=ar
Eragra3 commented 1 day ago

I have the same problem on Windows when using Bevy game engine. Any change triggers blake3 recompilation - is this expected?

Edit: it seems like clippy may be triggering that. It happens on code change when I use RustRover, because I configured it to run clippy in the background. I'm still not sure if this is expected or not.

oconnor663 commented 21 hours ago

Folks who can repro this, can you help me clarify: Are the values of these env vars actually changing every time? If so what sort of values are they taking? (If not, could this be a cc bug?)

justinabrahms commented 17 hours ago

Just a note that I no longer work for this company and don't have access to that laptop or code base. Hopefully Max will be of more help to you.