-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support incremental builds with CMake
When CMake builds a project, it generates a file called `CMakeCache.txt` that contains - among others - a dump of environmental variables. This file is generated both for the deps-only- and the main- derivation, and if env-vars happen to differ between both¹, CMake will refuse to compile the latter derivation, saying: ``` CMake Error: The current CMakeCache.txt directory ... is different than the directory ... where CMakeCache.txt was created. ``` Solving this problem is easy - one just has to remove `CMakeCache.txt` to let CMake regenerate it. Note that the original bug report (linked below) suggests to use `sed`, but that doesn't work on Darwin which uses a different convention for temporary paths - compare error messages for the failing derivations: ... on Linux: ``` CMake Error: The current CMakeCache.txt directory /build/source/target/release/build/oqs-sys-a19e222d9ef825d3/out/build/CMakeCache.txt is different than the directory /build/dummy-src/target/release/build/oqs-sys-a19e222d9ef825d3/out/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt ``` ... and on Darwin: ``` CMake Error: The current CMakeCache.txt directory /tmp/nix-build-app-0.1.0.drv-5/source/target/release/build/oqs-sys-4b5e25b1671aa1e5/out/build/CMakeCache.txt is different than the directory /tmp/nix-build-app-deps-0.1.0.drv-0/source/target/release/build/oqs-sys-4b5e25b1671aa1e5/out/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt ``` As for the implementation, since two-step builds are a Naersk-specific construct, I think solving this transparently on Naersk's side instead of just adding a tip into README.md is the better approach here, since it keeps Naersk plug-and-play'able. Closes #285. ¹ which is not that difficult, e.g. that's how `pkgs.rustPlatform.bindgenHook` behaves
- Loading branch information
Showing
13 changed files
with
610 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
naersk.buildPackage { | ||
src = sources.agent-rs; | ||
doCheck = true; | ||
|
||
buildInputs = [ | ||
pkgs.openssl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
args: { | ||
agent-rs = import ./agent-rs args; | ||
lorri = import ./lorri args; | ||
nushell = import ./nushell args; | ||
ripgrep-all = import ./ripgrep-all args; | ||
rustlings = import ./rustlings args; | ||
talent-plan = import ./talent-plan args; | ||
|
||
# Make sure we can compile projects with a complex workspace setup | ||
# (https://github.com/nix-community/naersk/issues/274) | ||
nushell = import ./nushell args; | ||
|
||
# Make sure we can compile projects that use CMake | ||
# (https://github.com/nix-community/naersk/issues/285) | ||
oqs = import ./oqs args; | ||
} |
Oops, something went wrong.