From 0697a4a55b7cf4dda0503e157886fe2b7178207f Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 23 Mar 2024 09:18:53 -0400 Subject: [PATCH] ncnn: fix build on Darwin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ncnn defaults to static linkage on Darwin against MoltenVK, but static libraries are not build by default for MoltenVK in nixpkgs, and it’s not taken as a dependency anyway. Override this behavior by specifying `Vulkan_LIBRARY` explicitly as `-lvulkan` on Darwin. --- pkgs/development/libraries/ncnn/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/ncnn/default.nix b/pkgs/development/libraries/ncnn/default.nix index 71b4bbc8fd42..88a6d042cbf4 100644 --- a/pkgs/development/libraries/ncnn/default.nix +++ b/pkgs/development/libraries/ncnn/default.nix @@ -33,7 +33,9 @@ stdenv.mkDerivation rec { "-DNCNN_BUILD_TOOLS=0" "-DNCNN_SYSTEM_GLSLANG=1" "-DNCNN_PYTHON=0" # Should be an attribute - ]; + ] + # Requires setting `Vulkan_LIBRARY` on Darwin. Otherwise the build fails due to missing symbols. + ++ lib.optionals stdenv.isDarwin [ "-DVulkan_LIBRARY=-lvulkan" ]; nativeBuildInputs = [ cmake ]; buildInputs = [ vulkan-headers vulkan-loader glslang opencv protobuf ];