Skip to content

Conversation

@bleggett
Copy link
Collaborator

@bleggett bleggett commented Dec 2, 2025

.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))

makes bindgen autowatch every header the build.rs clones into OUT_DIR.

This can force spurious rebuilds if a cloned header in OUT_DIR gets touched with a new mtime, or whatever.

But we can just turn this off and only trigger rebuilds on:

    println!("cargo:rerun-if-changed=build.rs");
    println!("cargo:rerun-if-changed=inc/libscap.h");

this ought to be safe because the cloned files in OUT_DIR are transient, and you can't update the clone ref without touching build.rs itself (which would rerun) - so we really don't need to care about triggering rebuilds if the cloned libscap source headers change.

This will not guard against someone or something locally munging files in OUT_DIR and breaking their own build/local OUT_DIR corruption/etc, but that's not likely and if it did happen, a cargo clean would resolve it anyway.

@bleggett bleggett enabled auto-merge (squash) December 2, 2025 22:47
@tycho
Copy link
Member

tycho commented Dec 3, 2025

Hmm, I'd still like to figure out the root cause of why scap.h had a newer timestamp than the output somehow. I couldn't find anything obvious in the source tree that would explain why its mtime was modified after the build finished.

The workaround seems simple enough though.

@bleggett
Copy link
Collaborator Author

bleggett commented Dec 3, 2025

Hmm, I'd still like to figure out the root cause of why scap.h had a newer timestamp than the output somehow. I couldn't find anything obvious in the source tree that would explain why its mtime was modified after the build finished.

Yeah I couldn't either. Nothing any of our (or Falco's build scripts) are doing should cause mtime updates AFAICT. How exactly are you reproducing/inducing the spurious rebuilds? I haven't been able to/haven't noticed spurious rebuilds but I might not be doing exactly what you're doing.

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

Successfully merging this pull request may close these issues.

3 participants