From e8fe103b17164a8b5d5f3fb627648ffebe428787 Mon Sep 17 00:00:00 2001 From: Ismael Casaban Date: Fri, 31 Jul 2026 15:49:19 +0200 Subject: [PATCH 1/4] fix ci --- CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbc8fd3..c9df8af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -474,6 +474,40 @@ FetchContent_Declare( FetchContent_MakeAvailable(llama) +# Workaround for macOS CI (C++23 libc++ / Apple Clang): +# llama.cpp model source files (dflash.cpp, t5.cpp, eagle3.cpp) define build_arch_graph before graph constructor specializations, +# causing "explicit specialization after instantiation" error on Apple Clang. +if(EXISTS "${llama_SOURCE_DIR}/src/models/dflash.cpp") + file(READ "${llama_SOURCE_DIR}/src/models/dflash.cpp" LLAMA_DFLASH_CPP) + if(NOT LLAMA_DFLASH_CPP MATCHES "template <>[^\n]*graph::graph") + string(REPLACE "#include \"models.h\"" + "#include \"models.h\"\n\ntemplate <> llama_model_dflash::graph::graph(const llama_model &, const llm_graph_params &);\ntemplate <> llama_model_dflash::graph::graph(const llama_model &, const llm_graph_params &);" + LLAMA_DFLASH_CPP "${LLAMA_DFLASH_CPP}") + file(WRITE "${llama_SOURCE_DIR}/src/models/dflash.cpp" "${LLAMA_DFLASH_CPP}") + endif() +endif() + +if(EXISTS "${llama_SOURCE_DIR}/src/models/t5.cpp") + file(READ "${llama_SOURCE_DIR}/src/models/t5.cpp" LLAMA_T5_CPP) + if(NOT LLAMA_T5_CPP MATCHES "template <>[^\n]*graph::graph") + string(REPLACE "#include \"models.h\"" + "#include \"models.h\"\n\ntemplate <> llama_model_t5::graph::graph(const llama_model &, const llm_graph_params &);\ntemplate <> llama_model_t5::graph::graph(const llama_model &, const llm_graph_params &);" + LLAMA_T5_CPP "${LLAMA_T5_CPP}") + file(WRITE "${llama_SOURCE_DIR}/src/models/t5.cpp" "${LLAMA_T5_CPP}") + endif() +endif() + +if(EXISTS "${llama_SOURCE_DIR}/src/models/eagle3.cpp") + file(READ "${llama_SOURCE_DIR}/src/models/eagle3.cpp" LLAMA_EAGLE3_CPP) + if(NOT LLAMA_EAGLE3_CPP MATCHES "template <>[^\n]*graph::graph") + string(REPLACE "#include \"models.h\"" + "#include \"models.h\"\n\ntemplate <> llama_model_eagle3::graph::graph(const llama_model &, const llm_graph_params &);\ntemplate <> llama_model_eagle3::graph::graph(const llama_model &, const llm_graph_params &);" + LLAMA_EAGLE3_CPP "${LLAMA_EAGLE3_CPP}") + file(WRITE "${llama_SOURCE_DIR}/src/models/eagle3.cpp" "${LLAMA_EAGLE3_CPP}") + endif() +endif() + + ################################ # whisper ################################ From 785b1e59ff36307e2767d0e0990076f0306bca19 Mon Sep 17 00:00:00 2001 From: Ismael Casaban Date: Fri, 31 Jul 2026 17:57:01 +0200 Subject: [PATCH 2/4] fix ci --- CMakeLists.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9df8af..40578ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -518,6 +518,11 @@ set(WHISPER_BUILD_EXTRA_TARGETS OFF CACHE BOOL "Disable whisper extra targets (p set(WHISPER_PARAKEET OFF CACHE BOOL "Disable parakeet model support" FORCE) set(CMAKE_CXX_SCAN_FOR_MODULES OFF CACHE BOOL "Disable C++ modules scanning for Vulkan-Headers" FORCE) +# Ensure GGML target from llama exists before configuring whisper +if(NOT TARGET ggml OR NOT EXISTS "${llama_SOURCE_DIR}/ggml/include") + message(FATAL_ERROR "GGML library target from Llama is not available for whisper. Aborting configuration.") +endif() + FetchContent_Declare( whisper GIT_REPOSITORY https://github.com/ggml-org/whisper.cpp.git @@ -529,15 +534,20 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(whisper) +if(NOT TARGET ggml) + message(FATAL_ERROR "Whisper is not using GGML from Llama. Aborting configuration.") +endif() + target_include_directories(whisper PUBLIC - $ - $ + $ + $ ) set_target_properties(whisper PROPERTIES CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON ) + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") target_compile_options(whisper PRIVATE -O3) if(TARGET ggml-cpu) From 5c082d3f3d5761a1b94a8320cdb8d03c402b8e2c Mon Sep 17 00:00:00 2001 From: Ismael Casaban Date: Fri, 31 Jul 2026 18:15:25 +0200 Subject: [PATCH 3/4] fix ci --- CMakeLists.txt | 5 ++--- cmake/library_install_infra.cmake | 6 ++++++ cmake/library_install_test.cmake | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40578ce..92f6953 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,9 +38,7 @@ endif() option(ENABLE_COVERAGE "Enable code coverage compilation flags" ON) if(ENABLE_COVERAGE) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - add_compile_options(--coverage) - add_link_options(--coverage) - message(STATUS "Code coverage instrumentation enabled") + message(STATUS "Code coverage instrumentation enabled for project targets") find_program(GCOV_PATH NAMES gcov gcov.exe) if(GCOV_PATH) set(CTEST_COVERAGE_COMMAND "${GCOV_PATH}") @@ -62,6 +60,7 @@ if(ENABLE_COVERAGE) endif() endif() + set(CMAKE_MAIN_PROJECT_NAME ${PROJECT_NAME}) add_compile_definitions(MAIN_PROJECT_NAME=${PROJECT_NAME}) diff --git a/cmake/library_install_infra.cmake b/cmake/library_install_infra.cmake index bf63bbf..dbd6e67 100644 --- a/cmake/library_install_infra.cmake +++ b/cmake/library_install_infra.cmake @@ -50,6 +50,11 @@ function(create_infra_library) $ ) + if(ENABLE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + target_compile_options(${TARGET_NAME} PRIVATE --coverage) + target_link_options(${TARGET_NAME} PRIVATE --coverage) + endif() + # install target install(TARGETS ${TARGET_NAME} EXPORT ${TARGET_NAME}Targets @@ -59,4 +64,5 @@ function(create_infra_library) INCLUDES DESTINATION ${INSTALL_INCLUDE_DIR} ) + endfunction(create_infra_library) \ No newline at end of file diff --git a/cmake/library_install_test.cmake b/cmake/library_install_test.cmake index b334f37..6064361 100644 --- a/cmake/library_install_test.cmake +++ b/cmake/library_install_test.cmake @@ -40,9 +40,15 @@ function(create_test_exec) target_link_options(${PARSED_ARGS_TARGET} PRIVATE -Wl,--allow-multiple-definition) endif() + if(ENABLE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + target_compile_options(${PARSED_ARGS_TARGET} PRIVATE --coverage) + target_link_options(${PARSED_ARGS_TARGET} PRIVATE --coverage) + endif() + # Set the runtime output directory for each executable set_target_properties(${PARSED_ARGS_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/Test) add_test(NAME ${PARSED_ARGS_TARGET} COMMAND ${PARSED_ARGS_TARGET} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin/Test) + endfunction(create_test_exec) \ No newline at end of file From 5190db74eb4e70a8e0bedabe9a833b37028a8c62 Mon Sep 17 00:00:00 2001 From: Ismael Casaban Date: Fri, 31 Jul 2026 18:26:16 +0200 Subject: [PATCH 4/4] fix ci --- cmake/library_install_infra.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/library_install_infra.cmake b/cmake/library_install_infra.cmake index dbd6e67..2161d98 100644 --- a/cmake/library_install_infra.cmake +++ b/cmake/library_install_infra.cmake @@ -51,10 +51,11 @@ function(create_infra_library) ) if(ENABLE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - target_compile_options(${TARGET_NAME} PRIVATE --coverage) - target_link_options(${TARGET_NAME} PRIVATE --coverage) + target_compile_options(${TARGET_NAME} PUBLIC --coverage) + target_link_options(${TARGET_NAME} PUBLIC --coverage) endif() + # install target install(TARGETS ${TARGET_NAME} EXPORT ${TARGET_NAME}Targets