backstory
I wanted to try out dbcrossbar: a utility for transferring data to and fro databases.
I use nix to manage various open source software installations on my mac. OpenSSL is one example.
Some packages have trouble finding nix’s custom locations for packages such as OpenSSL. As a result you’ll sometimes see cargo install
errors about not finding your system’s OpenSSL installation. Other obscure errors arise too.
simple fix
I use a simple workaround.
- Define a
shell.nix
- nix-shell
cargo install dbcrossbar
addenda and shell.nix
Compiling dbcrossbar
kept failing even with a basic shell.nix
. It failed with:
= note: ld: framework not found Security
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: aborting due to previous error
error: failed to compile `dbcrossbar v0.4.1`, intermediate artifacts can be found at `/var/folders/r6/1tb0c_rn22xdhm39d62y6rfh0000gn/T/cargo-install6YxSuq`
Caused by:
could not compile `dbcrossbar`.
To learn more, run the command again with --verbose.
It turns out I needed to provide darwin.apple_sdk.frameworks.Security
to buildInputs
.
So the final working shell.nix
is:
with import <nixpkgs> { };
pkgs.mkShell {
buildInputs = [
darwin.apple_sdk.frameworks.Security
pkgconfig
openssl
];
}
Hopefully this spares you seconds, minutes, and hours combing the Internet for a solution. Now onto exploring dbcrossbar
!