summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/llama-cpp-python
diff options
context:
space:
mode:
authorIhar Hrachyshka <ihar.hrachyshka@gmail.com>2025-01-27 23:38:40 -0500
committerIhar Hrachyshka <ihar.hrachyshka@gmail.com>2025-01-28 23:36:00 -0500
commit443cb1ec56d8188f1249ad18656aee6d9dc5021f (patch)
tree314f6a6aec3d7f4f14d5c42557806b653ebaebf0 /pkgs/development/python-modules/llama-cpp-python
parentde0e0b0b62b714b444f232bb384fe3950b3a0ca4 (diff)
python312Packages.llama-cpp-python: fix linux build
Their cmake files were attempting to build with -mcpu=native+no<...> which fails for gcc. Actually, we should never build for native anyway (which is the raison d'etre for NIX_ENFORCE_NO_NATIVE). Thankfully, the package provides a variable to disable native optimizations.
Diffstat (limited to 'pkgs/development/python-modules/llama-cpp-python')
-rw-r--r--pkgs/development/python-modules/llama-cpp-python/default.nix15
1 files changed, 10 insertions, 5 deletions
diff --git a/pkgs/development/python-modules/llama-cpp-python/default.nix b/pkgs/development/python-modules/llama-cpp-python/default.nix
index 09ee66b8caf0..00dd70400d86 100644
--- a/pkgs/development/python-modules/llama-cpp-python/default.nix
+++ b/pkgs/development/python-modules/llama-cpp-python/default.nix
@@ -64,7 +64,16 @@ buildPythonPackage rec {
dontUseCmakeConfigure = true;
SKBUILD_CMAKE_ARGS = lib.strings.concatStringsSep ";" (
- lib.optionals cudaSupport [
+ # Set GGML_NATIVE=off. Otherwise, cmake attempts to build with
+ # -march=native* which is either a no-op (if cc-wrapper is able to ignore
+ # it), or an attempt to build a non-reproducible binary.
+ #
+ # This issue was spotted when cmake rules appended feature modifiers to
+ # -mcpu, breaking linux build as follows:
+ #
+ # cc1: error: unknown value ‘native+nodotprod+noi8mm+nosve’ for ‘-mcpu’
+ [ "-DGGML_NATIVE=off" ]
+ ++ lib.optionals cudaSupport [
"-DGGML_CUDA=on"
"-DCUDAToolkit_ROOT=${lib.getDev cudaPackages.cuda_nvcc}"
"-DCMAKE_CUDA_COMPILER=${lib.getExe cudaPackages.cuda_nvcc}"
@@ -133,9 +142,5 @@ buildPythonPackage rec {
changelog = "https://github.com/abetlen/llama-cpp-python/blob/v${version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ kirillrdy ];
- badPlatforms = [
- # cc1: error: unknown value ‘native+nodotprod+noi8mm+nosve’ for ‘-mcpu’
- "aarch64-linux"
- ];
};
}