[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: llama.cpp, whisper.cpp, ggml: Next steps



Hi Petter,

I've added the final polish to ggml by fixing the generated pkg-config
and cmake packages.

However, these too are installed in private directories, so as to not be
exposed by default. This may be overly cautious though, and can be
changed anytime.

On 2025-02-26 16:39, Petter Reinholdtsen wrote:
> I managed to get the whisper.cpp git repo on salsa to build with the
> non-embedded ggml package.  Please have a look at
> <URL: https://salsa.debian.org/deeplearning-team/whisper.cpp >.
> 
> Note, I am conviced 2010-ext-ggml.patch need a rewrite by someone who
> understand cmake more than me, as its way of linking to the system
> libraries is a bit nasty, and I would rather use -L/usr/lib... instead
> of listing the library path directly.

Please find attached an updated version of your patch that uses the
cmake package shipped by the most recent src:ggml.

The set() before find_package is required so that the aforementioned
private location of the cmake package is in the search path. Otherwise,
this would be even simpler.

Best,
Christian
Description: Switch to using external ggml implementation.
 Drop using the enbedded ggml edition and use the future Debian
 package instead.  The library locating setup probably need more work.
Author: Petter Reinholdtsen <pere@debian.org>
Forwarded: not-needed
Last-Update: 2025-02-25
---
Index: whisper.cpp-1.7.4/CMakeLists.txt
===================================================================
--- whisper.cpp-1.7.4.orig/CMakeLists.txt
+++ whisper.cpp-1.7.4/CMakeLists.txt
@@ -120,10 +120,10 @@ whisper_option_depr(WARNING     WHISPER_
 # build the library
 #
 
-if (NOT TARGET ggml)
-    add_subdirectory(ggml)
-    # ... otherwise assume ggml is added by a parent CMakeLists.txt
-endif()
+#if (NOT TARGET ggml)
+#    add_subdirectory(ggml)
+#    # ... otherwise assume ggml is added by a parent CMakeLists.txt
+#endif()
 add_subdirectory(src)
 
 #
Index: whisper.cpp-1.7.4/src/CMakeLists.txt
===================================================================
--- whisper.cpp-1.7.4.orig/src/CMakeLists.txt
+++ whisper.cpp-1.7.4/src/CMakeLists.txt
@@ -28,6 +28,9 @@ if (WHISPER_OPENVINO)
     find_package(OpenVINO REQUIRED COMPONENTS Runtime)
 endif()
 
+set(CMAKE_PREFIX_PATH "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/ggml/cmake-private" ${CMAKE_PREFIX_PATH})
+find_package(ggml REQUIRED)
+
 #
 # libraries
 #
@@ -98,7 +101,7 @@ if (WHISPER_EXTRA_FLAGS)
     target_compile_options(whisper PRIVATE ${WHISPER_EXTRA_FLAGS})
 endif()
 
-target_link_libraries(whisper PUBLIC ggml)
+target_link_libraries(whisper PUBLIC ggml::ggml ggml::ggml-base)
 
 if (WHISPER_COREML)
     target_link_libraries(whisper PRIVATE whisper.coreml)

Reply to: