diff --git a/pkgs/by-name/ll/llama-cpp/package.nix b/pkgs/by-name/ll/llama-cpp/package.nix index d5acf81b6431..bc3729b62053 100644 --- a/pkgs/by-name/ll/llama-cpp/package.nix +++ b/pkgs/by-name/ll/llama-cpp/package.nix @@ -1,5 +1,6 @@ { lib, + buildPackages, autoAddDriverRunpath, cmake, fetchFromGitHub, @@ -81,6 +82,8 @@ let vulkan-headers vulkan-loader ]; + + buildCc = buildPackages.stdenv.cc; in effectiveStdenv.mkDerivation (finalAttrs: { pname = "llama-cpp"; @@ -120,6 +123,11 @@ effectiveStdenv.mkDerivation (finalAttrs: { shaderc ]; + depsBuildBuild = optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + # llama-ui-embed under tools/ui needs a host compiler + buildCc + ]; + buildInputs = optionals cudaSupport cudaBuildInputs ++ optionals openclSupport [ clblast ] @@ -185,6 +193,9 @@ effectiveStdenv.mkDerivation (finalAttrs: { ++ optionals metalSupport [ (cmakeFeature "CMAKE_C_FLAGS" "-D__ARM_FEATURE_DOTPROD=1") (cmakeBool "LLAMA_METAL_EMBED_LIBRARY" true) + ] + ++ optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + (cmakeFeature "HOST_CXX_COMPILER" (lib.getExe' buildCc "${buildCc.targetPrefix}c++")) ]; postInstall = optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''