Depending on Apple Frameworks in your Nix Flakes.
You may find yourself faced with the following error:
❯ cargo build
Compiling project-name v0.1.0 (/Users/mirosval/Projekty/test)
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" <omitted>
= note: ld: framework not found Security
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile `project-name` (bin "project-name") due to previous error
It may be concerning some other Apple Framework, most commonly I've found it to be either Security
, Security
, SystemConfiguration
, Accelerate
or else it's one of the other Apple Frameworks.
This happens because your Nix shell is isolated from the rest of the system and these frameworks are an undeclard dependency of your project.
So in order to fix it, you need to add the offending frameworks to your Nix configuration (Flake or shell.nix
):
with pkgs;
{
devShells.default = mkShell {
buildInputs = [
rustToolchain
darwin.apple_sdk.frameworks.SystemConfiguration # <-- HERE
];
packages = [
cargo-watch
];
};
}