docs: add section about using different toolchains (#256)

This commit is contained in:
Ivan Petkov 2023-03-01 01:27:29 +00:00 committed by GitHub
parent 685e7494b0
commit ac145b7ae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -26,6 +26,7 @@
* [Customizing nixpkgs and other inputs](./faq/custom-nixpkgs.md)
* [IFD (import from derivation) errors](./faq/ifd-error.md)
* [Constantly rebuilding from scratch](./faq/constant-rebuilds.md)
* [Crates being rebuilt when using different toolchains](./faq/rebuilds-with-different-toolchains.md)
* [Building upstream cargo crate with no `Cargo.lock`](./faq/no-cargo-lock.md)
* [Patching `Cargo.lock` during build](./faq/patching-cargo-lock.md)
* [Building a subset of a workspace](./faq/build-workspace-subset.md)

View File

@ -0,0 +1,15 @@
## Dependencies being rebuilt even with proper source filtering applied
If the dependency crates are being rebuilt even after proper source filtering
has been applied (i.e. the `crate-depsOnly` derivation is NOT being rebuilt)
check that the same Rust/Cargo toolchain is being used when building artifacts
and vendoring crate sources.
The crate artifacts can only be used for the same compiler version, so if cargo
sees artifacts for the wrong toolchain it will rebuild everything from scratch.
Note that each instance of `crane` tied to a single Rust toolchain (by default
the one available in `nixpkgs`, but this can be overridden by the caller). If
you are using multiple `craneLib` instantiations and you see this occurring,
double check that they aren't being created with a different toolchain
(especially if cross-compilation is being used for the project).