From 9f772dd261dd2841ccd968714a685eb24318091a Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sat, 18 Apr 2026 14:15:01 +0000 Subject: [PATCH] fix(turboquant): resolve common.h by detecting llama-common vs common target The shared grpc-server CMakeLists hardcoded `llama-common`, the post-rename target name in upstream llama.cpp. The turboquant fork branched before that rename and still exposes the helpers library as `common`, so the name silently degraded to a plain `-llama-common` link flag, the PUBLIC include directory was never propagated, and tools/server/server-task.h failed to find common.h during turboquant- builds. --- backend/cpp/llama-cpp/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/cpp/llama-cpp/CMakeLists.txt b/backend/cpp/llama-cpp/CMakeLists.txt index 9fcdca57380b..cb1f5298c543 100644 --- a/backend/cpp/llama-cpp/CMakeLists.txt +++ b/backend/cpp/llama-cpp/CMakeLists.txt @@ -62,7 +62,18 @@ add_executable(${TARGET} grpc-server.cpp json.hpp httplib.h) target_include_directories(${TARGET} PRIVATE ../llava) target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}) -target_link_libraries(${TARGET} PRIVATE llama-common llama mtmd ${CMAKE_THREAD_LIBS_INIT} absl::flags hw_grpc_proto +# Upstream llama.cpp renamed the `common` helpers library to `llama-common`. +# Forks that branched before the rename (e.g. llama-cpp-turboquant) still +# expose it as `common`. Detect which one is present so the same CMakeLists +# drives both builds — otherwise an unresolved name silently degrades to a +# plain `-l` flag and the PUBLIC include dir (where common.h lives) is lost. +if (TARGET llama-common) + set(_LLAMA_COMMON_TARGET llama-common) +else() + set(_LLAMA_COMMON_TARGET common) +endif() + +target_link_libraries(${TARGET} PRIVATE ${_LLAMA_COMMON_TARGET} llama mtmd ${CMAKE_THREAD_LIBS_INIT} absl::flags hw_grpc_proto absl::flags_parse gRPC::${_REFLECTION} gRPC::${_GRPC_GRPCPP}