From aacd1cb3947d9a9e2c7be4ad52b15a03984cac2d Mon Sep 17 00:00:00 2001 From: Nhan Nguyen Date: Mon, 15 Dec 2025 17:42:15 -0500 Subject: [PATCH] fix: define GGML_VERSION variables for proper SOVERSION expansion (#13469) The ggml/src/CMakeLists.txt uses GGML_VERSION_MAJOR for the shared library SOVERSION property, but these variables were not defined when building from ollama's CMakeLists.txt. This caused libggml-base.so to be named with a literal "SOVERSION" suffix (libggml-base.so.SOVERSION) instead of the actual version number (libggml-base.so.0). The fix adds the required GGML_VERSION_* variables before including the ggml subdirectory. Fixes #13436 --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 50a80629a..2820dee09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,13 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ml/backend/ggml/ggml/src/ggml-cp add_compile_definitions(NDEBUG GGML_VERSION=0x0 GGML_COMMIT=0x0) +# Define GGML version variables for shared library SOVERSION +# These are required by ggml/src/CMakeLists.txt for proper library versioning +set(GGML_VERSION_MAJOR 0) +set(GGML_VERSION_MINOR 0) +set(GGML_VERSION_PATCH 0) +set(GGML_VERSION "${GGML_VERSION_MAJOR}.${GGML_VERSION_MINOR}.${GGML_VERSION_PATCH}") + set(GGML_CPU ON) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ml/backend/ggml/ggml/src) set_property(TARGET ggml PROPERTY EXCLUDE_FROM_ALL TRUE)