File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 4
4
config ,
5
5
stdenv ,
6
6
mkShell ,
7
+ runCommand ,
7
8
cmake ,
8
9
ninja ,
9
10
pkg-config ,
87
88
]
88
89
) ;
89
90
91
+ xcrunHost = runCommand "xcrunHost" { } ''
92
+ mkdir -p $out/bin
93
+ ln -s /usr/bin/xcrun $out/bin
94
+ '' ;
95
+
90
96
# apple_sdk is supposed to choose sane defaults, no need to handle isAarch64
91
97
# separately
92
98
darwinBuildInputs =
@@ -157,6 +163,14 @@ effectiveStdenv.mkDerivation (
157
163
substituteInPlace ./*.py --replace "/usr/bin/env python" "${ llama-python } /bin/python"
158
164
'' ;
159
165
166
+ # With PR#6015 https://github.com/ggerganov/llama.cpp/pull/6015,
167
+ # `default.metallib` is compiled with Metal compiler from XCode
168
+ # and we need to escape sandbox on MacOS to access Metal compiler.
169
+ # `xcrun` is used find the path of the Metal compiler, which is varible
170
+ # and not on $PATH
171
+ # see https://github.com/ggerganov/llama.cpp/pull/6118 for discussion
172
+ __noChroot = effectiveStdenv . isDarwin && useMetalKit ;
173
+
160
174
nativeBuildInputs =
161
175
[
162
176
cmake
@@ -173,6 +187,8 @@ effectiveStdenv.mkDerivation (
173
187
]
174
188
++ optionals ( effectiveStdenv . hostPlatform . isGnu && enableStatic ) [
175
189
glibc . static
190
+ ] ++ optionals ( effectiveStdenv . isDarwin && useMetalKit ) [
191
+ xcrunHost
176
192
] ;
177
193
178
194
buildInputs =
You can’t perform that action at this time.
0 commit comments