From 173d0e6419e8f8f3c1f4f13201b777f4c60629f3 Mon Sep 17 00:00:00 2001 From: DaniAndTheWeb <57776841+DaniAndTheWeb@users.noreply.github.com> Date: Fri, 5 May 2023 23:57:14 +0200 Subject: [PATCH] makefile: automatic Arch Linux detection (#1332) This commit is a port of a detection method used in koboldcpp's Makefile in order to automatically set the -lcblas option on Arch Linux --- Makefile | 6 +++++- README.md | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 260b2487f..0ddff9961 100644 --- a/Makefile +++ b/Makefile @@ -107,7 +107,11 @@ ifndef LLAMA_NO_ACCELERATE endif ifdef LLAMA_OPENBLAS CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/openblas - LDFLAGS += -lopenblas + ifneq ($(shell grep -e "Arch Linux" -e "ID_LIKE=arch" /etc/os-release 2>/dev/null),) + LDFLAGS += -lopenblas -lcblas + else + LDFLAGS += -lopenblas + endif endif ifdef LLAMA_CUBLAS CFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include diff --git a/README.md b/README.md index 233c5c5e1..19cc94aa2 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,6 @@ Building the program with BLAS support may lead to some performance improvements ```bash make LLAMA_OPENBLAS=1 ``` - Note: In order to build on Arch Linux with OpenBLAS support enabled you must edit the Makefile adding at the end of the line 105: `-lcblas` - On Windows: