Closed bonofiglio closed 3 months ago
Use cargo -vvv
(or something like it) to figure out the reason for the rebuild.
Hi @bonofiglio thanks for the report! I see bindgen
showing up in the build log so you might be hitting this situation: https://github.com/ipetkov/crane/blob/7ce92819802bc583b7e82ebc08013a530f22209f/docs/faq/rebuilds-bindgen.md
If that's not the culprit I would double check whether the same buildInputs
and nativeBuildInputs
are being used across the derivation producing cargoArtifacts
(e.g. craneLib.buildDepsOnly
) and the derivation that is consuming it. I know that sometimes adding different inputs causes certain environment variables/paths to be updated, and a number of crate build scripts configure themselves to be re-run if those variables change.
I'm afraid I can't suggest anything beyond that without a flake which reproduces the problem!
Thank you for your both your answers @ipetkov and @dpc. The issue was exactly the one linked by @ipetkov. That is a very hard one to debug 😅
Hi, I'm running into rebuilds for some of my dependencies, but not all of them. Specifically, it seems like the
cargoArtifacts
are missing the dependencies with C bindings. In this casesurrealdb
with thespeedb
feature enabled (a C++ project).I summarized the logs a little to show the problem more concisely:
As you can see, there are 6 crates other than
my-crate
being built on the second step, but they were present on the first build, so they are being built twice. This wouldn't be such an issue in most cases, but these dependencies are about 80~% of the compile time of my crate, so caching them is essential for CI in my case.I tried looking around the docs to see if there was an option for this but I couldn't find anything.
Thank you for your time and for
crane
. Loving the project so far.