mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 21:40:12 +00:00
llama-cpp: fix cross compilation (#561060)
This commit is contained in:
@@ -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) ''
|
||||
|
||||
Reference in New Issue
Block a user