Symlink to /usr/bin/xcrun so that xcrun
binary
is usable during build (used for compiling Metal shaders) Fixes https://github.com/ggerganov/llama.cpp/issues/6117
This commit is contained in:
parent
b06c16ef9f
commit
973057a879
1 changed files with 16 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
config,
|
config,
|
||||||
stdenv,
|
stdenv,
|
||||||
mkShell,
|
mkShell,
|
||||||
|
runCommand,
|
||||||
cmake,
|
cmake,
|
||||||
ninja,
|
ninja,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
|
@ -87,6 +88,11 @@ let
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
xcrunHost = runCommand "xcrunHost" {} ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s /usr/bin/xcrun $out/bin
|
||||||
|
'';
|
||||||
|
|
||||||
# apple_sdk is supposed to choose sane defaults, no need to handle isAarch64
|
# apple_sdk is supposed to choose sane defaults, no need to handle isAarch64
|
||||||
# separately
|
# separately
|
||||||
darwinBuildInputs =
|
darwinBuildInputs =
|
||||||
|
@ -157,6 +163,14 @@ effectiveStdenv.mkDerivation (
|
||||||
substituteInPlace ./*.py --replace "/usr/bin/env python" "${llama-python}/bin/python"
|
substituteInPlace ./*.py --replace "/usr/bin/env python" "${llama-python}/bin/python"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# With PR#6015 https://github.com/ggerganov/llama.cpp/pull/6015,
|
||||||
|
# `default.metallib` is compiled with Metal compiler from XCode
|
||||||
|
# and we need to escape sandbox on MacOS to access Metal compiler.
|
||||||
|
# `xcrun` is used find the path of the Metal compiler, which is varible
|
||||||
|
# and not on $PATH
|
||||||
|
# see https://github.com/ggerganov/llama.cpp/pull/6118 for discussion
|
||||||
|
__noChroot = effectiveStdenv.isDarwin && useMetalKit;
|
||||||
|
|
||||||
nativeBuildInputs =
|
nativeBuildInputs =
|
||||||
[
|
[
|
||||||
cmake
|
cmake
|
||||||
|
@ -173,6 +187,8 @@ effectiveStdenv.mkDerivation (
|
||||||
]
|
]
|
||||||
++ optionals (effectiveStdenv.hostPlatform.isGnu && enableStatic) [
|
++ optionals (effectiveStdenv.hostPlatform.isGnu && enableStatic) [
|
||||||
glibc.static
|
glibc.static
|
||||||
|
] ++ optionals (effectiveStdenv.isDarwin && useMetalKit) [
|
||||||
|
xcrunHost
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue