Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Missing Include Directory for ggml-cpu in whisper.android CMakeLists #2624

Merged
merged 2 commits into from
Dec 14, 2024

Conversation

Thamster
Copy link
Contributor

This PR adds the ggml/src/ggml-cpu directory to the include paths in the CMakeLists.txt for the whisper.android example.
Context:

The JNI version of whisper.android requires the ggml-cpu include path for successful compilation. Without this addition, the build fails with missing header errors on Windows.
Changes:

Added the ggml/src/ggml-cpu directory to the include_directories list in CMakeLists.txt.

Testing:

Verified the build completes successfully on Windows after this change.
Observed the following error when building without this change:

fatal error: 'ggml-cpu-impl.h' file not found

1 error generated.
  [4/6] Building CXX object CMakeFiles/whisper_v8fp16_va.dir/C_/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp.o
  FAILED: CMakeFiles/whisper_v8fp16_va.dir/C_/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp.o
  C:\Users\adm1n\AppData\Local\Android\Sdk\ndk\25.2.9519653\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android26 --sysroot=C:/Users/adm1n/A
ppData/Local/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dwhisper_v8fp16_va_EXPORTS -IC:/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/exa
mples/whisper.android/lib/src/main/jni/whisper/../../../../../../.. -IC:/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/examples/whisper.android/lib/src/main/jni/whisper/../
../../../../../../src -IC:/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/examples/whisper.android/lib/src/main/jni/whisper/../../../../../../../include -IC:/Users/adm1n/Des
ktop/text-generation-webui/whisper.cpp/examples/whisper.android/lib/src/main/jni/whisper/../../../../../../../ggml/include -IC:/Users/adm1n/Desktop/text-generation-webui/whisper.cp
p/examples/whisper.android/lib/src/main/jni/whisper/../../../../../../../ggml/src -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-cano
nical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -march=armv8.2-a+fp16 -std=gnu++17 -MD -MT CMakeFiles/whisper_v8fp16_va.dir/C_/Us
ers/adm1n/Desktop/text-generation-webui/whisper.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp.o -MF CMakeFiles\whisper_v8fp16_va.dir\C_\Users\adm1n\Desktop\text-generation-webui\whisper.cpp\g
gml\src\ggml-cpu\ggml-cpu.cpp.o.d -o CMakeFiles/whisper_v8fp16_va.dir/C_/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp.o -c C:/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp
  In file included from C:/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp:6:
  C:/Users/adm1n/Desktop/text-generation-webui/whisper.cpp/ggml/src/ggml-cpu/amx/amx.h:2:10: fatal error: 'ggml-cpu-impl.h' file not found
  #include "ggml-cpu-impl.h"
           ^~~~~~~~~~~~~~~~~
  1 error generated.
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      @echo off
      "C:\\Users\\adm1n\\AppData\\Local\\Android\\Sdk\\cmake\\3.22.1\\bin\\ninja.exe" ^
        -C ^
        "C:\\Users\\adm1n\\Desktop\\text-generation-webui\\whisper.cpp\\examples\\whisper.android\\lib\\.cxx\\Debug\\3id2k6h3\\arm64-v8a" ^
        whisper ^
        whisper_v8fp16_va
    from C:\Users\adm1n\Desktop\text-generation-webui\whisper.cpp\examples\whisper.android\lib

This is a minor but necessary change to ensure smooth compilation of the JNI example for whisper.android.

@ggerganov
Copy link
Owner

Thanks. Could you also enable the CI workflow for Android. I disabled it because I didn't want to spend time on resolving the build issue, but it seems this might have been the reason.

@Thamster Thamster force-pushed the ggml-cpu-cmake-include-fix branch from e3a830d to 1be4938 Compare December 13, 2024 18:30
@Thamster
Copy link
Contributor Author

Thamster commented Dec 14, 2024

The android JNI workflow appears to have been successful on my fork after re-enabling.

https://github.com/Thamster/whisper.cpp/actions/runs/12321069974/job/34391691044

Let me know if there's anything else I can help with regarding the CI setup or further testing.

@ggerganov ggerganov merged commit 6a52eae into ggerganov:master Dec 14, 2024
@Thamster Thamster deleted the ggml-cpu-cmake-include-fix branch December 14, 2024 21:11
bygreencn added a commit to bygreencn/whisper.cpp that referenced this pull request Dec 18, 2024
# By Georgi Gerganov (4) and others
# Via GitHub
* ggerganov/master:
  stream : improve consistency in README (ggerganov#2642)
  whisper : support no_speech_thold (ggerganov#2625)
  whisper : add single-timestamp logic (ggerganov#2629)
  readme : fix typo (ggerganov#2637)
  cmake : fix "amd64" processor string (ggerganov#2638)
  vulkan : fix soft_max.comp division by zero (ggerganov#2633)
  common : add cstdio header
  stream : update build instructions
  android : fix build and ci (ggerganov#2624)
  models : fix typo in download-ggml-model.sh (ggerganov#2623)
  ruby : Sync whisper.cpp and model download feature (ggerganov#2617)
  scripts : update to new build system

# Conflicts:
#	src/whisper.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants