Skip to content

Commit 4d20253

Browse files
committed
fixed llama.cpp build issue on ARM (Apple aarch64)
1 parent 451fea3 commit 4d20253

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llama-cpp-sys-2/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,15 @@ fn main() {
335335
println!("cargo:rustc-link-lib=c++_shared");
336336
}
337337
}
338+
339+
if matches!(target_os, TargetOs::Linux)
340+
&& target_triple.contains("aarch64")
341+
&& std::fs::metadata("/.dockerenv").is_ok()
342+
{
343+
// If we're running in a Docker container on ARM64, we need to disable native optimizations
344+
// because the host system may not have the same CPU features as the container.
345+
config.define("GGML_NATIVE", "OFF");
346+
}
338347

339348
if cfg!(feature = "vulkan") {
340349
config.define("GGML_VULKAN", "ON");

0 commit comments

Comments
 (0)