mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-18 21:33:39 -09:00
package/llama-cpp: new package
Add a package for llama.cpp, a C/C++ LLM inference library, used in popular projects like Ollama, RamaLama, and more. Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com> [Julien: - add a Config.in comment justifying the dynamic libraries for uclibc - add missing conditions in Config.in toolchain dependencies ] Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
committed by
Julien Olivain
parent
154f6694f6
commit
03f35bc63b
@@ -1754,6 +1754,7 @@ F: package/at-spi2-core/
|
||||
F: package/earlyoom/
|
||||
F: package/gconf/
|
||||
F: package/libnss/
|
||||
F: package/llama-cpp/
|
||||
F: package/llvm-project/clang/
|
||||
F: package/llvm-project/lld/
|
||||
F: package/llvm-project/llvm/
|
||||
|
||||
@@ -2290,6 +2290,7 @@ comment "linux-pam plugins"
|
||||
source "package/libpam-tacplus/Config.in"
|
||||
endif
|
||||
source "package/liquid-dsp/Config.in"
|
||||
source "package/llama-cpp/Config.in"
|
||||
source "package/llvm-project/llvm/Config.in"
|
||||
source "package/lttng-libust/Config.in"
|
||||
source "package/matio/Config.in"
|
||||
|
||||
51
package/llama-cpp/Config.in
Normal file
51
package/llama-cpp/Config.in
Normal file
@@ -0,0 +1,51 @@
|
||||
config BR2_PACKAGE_LLAMA_CPP_ARCH_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
depends on !BR2_s390x_z13 # ggml requires z14 or higher
|
||||
|
||||
config BR2_PACKAGE_LLAMA_CPP
|
||||
bool "llama.cpp"
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
depends on BR2_PACKAGE_LLAMA_CPP_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
|
||||
# llama.cpp needs libexecinfo when built with uclibc,
|
||||
# and libexecinfo needs dynamic libraries.
|
||||
depends on !BR2_TOOLCHAIN_USES_UCLIBC \
|
||||
|| (BR2_TOOLCHAIN_USES_UCLIBC && !BR2_STATIC_LIBS)
|
||||
depends on BR2_USE_WCHAR
|
||||
select BR2_PACKAGE_LIBEXECINFO if BR2_TOOLCHAIN_USES_UCLIBC
|
||||
help
|
||||
LLM inference in C/C++
|
||||
|
||||
https://github.com/ggml-org/llama.cpp
|
||||
|
||||
if BR2_PACKAGE_LLAMA_CPP
|
||||
|
||||
config BR2_PACKAGE_LLAMA_CPP_TOOLS
|
||||
bool "Enable tools"
|
||||
help
|
||||
Build CLI tools like llama-cli, llama-bench, etc.
|
||||
|
||||
config BR2_PACKAGE_LLAMA_CPP_SERVER
|
||||
bool "Enable server"
|
||||
help
|
||||
Build OpenAI API-compatible web server, llama-server.
|
||||
|
||||
config BR2_PACKAGE_LLAMA_CPP_VULKAN
|
||||
bool "Vulkan support"
|
||||
depends on !BR2_ARM_CPU_ARMV5
|
||||
depends on !BR2_STATIC_LIBS # vulkan-loader
|
||||
select BR2_PACKAGE_VULKAN_LOADER
|
||||
help
|
||||
Enable Vulkan backend for GPU acceleration.
|
||||
|
||||
endif
|
||||
|
||||
comment "llama-cpp needs a toolchain w/ C++, wchar, threads, and gcc >= 9"
|
||||
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR \
|
||||
|| !BR2_TOOLCHAIN_HAS_THREADS \
|
||||
|| !BR2_TOOLCHAIN_GCC_AT_LEAST_9
|
||||
|
||||
comment "llama-cpp needs a uclibc toolchain w/ dynamic library"
|
||||
depends on BR2_TOOLCHAIN_USES_UCLIBC && BR2_STATIC_LIBS
|
||||
4
package/llama-cpp/llama-cpp.hash
Normal file
4
package/llama-cpp/llama-cpp.hash
Normal file
@@ -0,0 +1,4 @@
|
||||
# Locally calculated
|
||||
sha256 c108fadd61d34da6ff2cfdf085821ff03a45acde2245d9eeeba9358482b305c3 b6865.tar.gz
|
||||
# License
|
||||
sha256 e562a2ddfaf8280537795ac5ecd34e3012b6582a147ef69ba6a6a5c08c84757d LICENSE
|
||||
70
package/llama-cpp/llama-cpp.mk
Normal file
70
package/llama-cpp/llama-cpp.mk
Normal file
@@ -0,0 +1,70 @@
|
||||
################################################################################
|
||||
#
|
||||
# llama.cpp
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LLAMA_CPP_VERSION = b6865
|
||||
LLAMA_CPP_SOURCE = $(LLAMA_CPP_VERSION).tar.gz
|
||||
LLAMA_CPP_SITE = https://github.com/ggml-org/llama.cpp/archive/refs/tags
|
||||
LLAMA_CPP_LICENSE = MIT
|
||||
LLAMA_CPP_LICENSE_FILES = LICENSE
|
||||
LLAMA_CPP_CPE_ID_VENDOR = ggml
|
||||
LLAMA_CPP_CPE_ID_PRODUCT = llama.cpp
|
||||
LLAMA_CPP_INSTALL_STAGING = YES
|
||||
LLAMA_CPP_CONF_OPTS = \
|
||||
-DLLAMA_BUILD_TESTS=OFF \
|
||||
-DLLAMA_BUILD_EXAMPLES=OFF \
|
||||
-DLLAMA_FATAL_WARNINGS=OFF
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBEXECINFO),y)
|
||||
LLAMA_CPP_DEPENDENCIES += libexecinfo
|
||||
LLAMA_CPP_LDFLAGS += -lexecinfo
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
|
||||
LLAMA_CPP_LDFLAGS += -latomic
|
||||
endif
|
||||
|
||||
LLAMA_CPP_CONF_OPTS += \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$(LLAMA_CPP_LDFLAGS)"
|
||||
|
||||
ifeq ($(BR2_STATIC_LIBS),y)
|
||||
LLAMA_CPP_CONF_OPTS += -DBUILD_SHARED_LIBS=OFF \
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBCURL),y)
|
||||
LLAMA_CPP_CONF_OPTS += -DLLAMA_CURL=ON
|
||||
LLAMA_CPP_DEPENDENCIES += libcurl
|
||||
else
|
||||
LLAMA_CPP_CONF_OPTS += -DLLAMA_CURL=OFF
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LLAMA_CPP_TOOLS),y)
|
||||
LLAMA_CPP_CONF_OPTS += -DLLAMA_BUILD_TOOLS=ON
|
||||
else
|
||||
LLAMA_CPP_CONF_OPTS += -DLLAMA_BUILD_TOOLS=OFF
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LLAMA_CPP_SERVER),y)
|
||||
LLAMA_CPP_CONF_OPTS += -DLLAMA_BUILD_SERVER=ON
|
||||
else
|
||||
LLAMA_CPP_CONF_OPTS += -DLLAMA_BUILD_SERVER=OFF
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LLAMA_CPP_VULKAN),y)
|
||||
LLAMA_CPP_DEPENDENCIES += vulkan-loader
|
||||
LLAMA_CPP_CONF_OPTS += -DGGML_VULKAN=ON
|
||||
else
|
||||
LLAMA_CPP_CONF_OPTS += -DGGML_VULKAN=OFF
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
|
||||
LLAMA_CPP_DEPENDENCIES += openblas
|
||||
LLAMA_CPP_CONF_OPTS += -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
|
||||
else
|
||||
LLAMA_CPP_CONF_OPTS += -DGGML_BLAS=OFF
|
||||
endif
|
||||
|
||||
$(eval $(cmake-package))
|
||||
Reference in New Issue
Block a user