Skip to content

Commit 117f643

Browse files
authored
fix(turboquant): resolve common.h by detecting llama-common vs common target (#9413)
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-<flavor> builds.
1 parent 7809c5f commit 117f643

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

backend/cpp/llama-cpp/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,18 @@ add_executable(${TARGET} grpc-server.cpp json.hpp httplib.h)
6262
target_include_directories(${TARGET} PRIVATE ../llava)
6363
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR})
6464

65-
target_link_libraries(${TARGET} PRIVATE llama-common llama mtmd ${CMAKE_THREAD_LIBS_INIT} absl::flags hw_grpc_proto
65+
# Upstream llama.cpp renamed the `common` helpers library to `llama-common`.
66+
# Forks that branched before the rename (e.g. llama-cpp-turboquant) still
67+
# expose it as `common`. Detect which one is present so the same CMakeLists
68+
# drives both builds — otherwise an unresolved name silently degrades to a
69+
# plain `-l` flag and the PUBLIC include dir (where common.h lives) is lost.
70+
if (TARGET llama-common)
71+
set(_LLAMA_COMMON_TARGET llama-common)
72+
else()
73+
set(_LLAMA_COMMON_TARGET common)
74+
endif()
75+
76+
target_link_libraries(${TARGET} PRIVATE ${_LLAMA_COMMON_TARGET} llama mtmd ${CMAKE_THREAD_LIBS_INIT} absl::flags hw_grpc_proto
6677
absl::flags_parse
6778
gRPC::${_REFLECTION}
6879
gRPC::${_GRPC_GRPCPP}

0 commit comments

Comments
 (0)