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

Error - Lexical or Preprocessor Issue on whisper_flutter #19

Open
Tryad0 opened this issue May 21, 2023 · 3 comments
Open

Error - Lexical or Preprocessor Issue on whisper_flutter #19

Tryad0 opened this issue May 21, 2023 · 3 comments

Comments

@Tryad0
Copy link

Tryad0 commented May 21, 2023

I got an error using 'whisper_flutter 0.0.4' on IOS and also Android:

---> IOS

Lexical or Preprocessor Issue (Xcode): '../../src/whisper_flutter.c' file not found
/Users/xxx/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/ios/Classes/whisper_dart.c:2:9

---> Android

Execution failed for task ':whisper_flutter:configureCMakeDebug[arm64-v8a]'.

[CXX1405] error when building with cmake using /Users/xxx/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/src/CMakeLists.txt: Build command failed.
Error while executing process /Users/xxx/Library/Android/sdk/cmake/3.18.1/bin/cmake with arguments {-H/Users/xxx/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/src -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=19 -DANDROID_PLATFORM=android-19 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DANDROID_NDK=/Users/xxx/Library/Android/sdk/ndk/25.1.8937393 -DCMAKE_ANDROID_NDK=/Users/xxx/Library/Android/sdk/ndk/25.1.8937393 -DCMAKE_TOOLCHAIN_FILE=/Users/xxx/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=/Users/xxx/Library/Android/sdk/cmake/3.18.1/bin/ninja -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/Users/xxx/Desktop/Projekte/Zaya/zaya/build/whisper_flutter/intermediates/cxx/Debug/214s131y/obj/arm64-v8a -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/Users/xxx/Desktop/Projekte/Zaya/zaya/build/whisper_flutter/intermediates/cxx/Debug/214s131y/obj/arm64-v8a -DCMAKE_BUILD_TYPE=Debug -B/Users/xxx/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/android/.cxx/Debug/214s131y/arm64-v8a -GNinja}
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/xxx/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Users/xxx/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Warning at /Users/xxx/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android-legacy.toolchain.cmake:415 (message):
An old version of CMake is being used that cannot automatically detect
compiler attributes. Compiler identification is being bypassed. Some
values may be wrong or missing. Update to CMake 3.19 or newer to use
CMake's built-in compiler identification.
Call Stack (most recent call first):
/Users/xxx/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake:54 (include)
/Users/xxx/Library/Android/sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)
CMakeLists.txt:6 (project)

CMake Warning at /Users/xxx/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android-legacy.toolchain.cmake:415 (message):
An old version of CMake is being used that cannot automatically detect
compiler attributes. Compiler identification is being bypassed. Some
values may be wrong or missing. Update to CMake 3.19 or newer to use
CMake's built-in compiler identification.
Call Stack (most recent call first):
/Users/xxx/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake:54 (include)
/Users/xxx/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/android/.cxx/Debug/214s131y/arm64-v8a/CMakeFiles/3.18.1-g262b901/CMakeSystem.cmake:6 (include)
/Users/xxx/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/android/.cxx/Debug/214s131y/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

CMake Warning at /Users/xxx/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android-legacy.toolchain.cmake:415 (message):
An old version of CMake is being used that cannot automatically detect
compiler attributes. Compiler identification is being bypassed. Some
values may be wrong or missing. Update to CMake 3.19 or newer to use
CMake's built-in compiler identification.
Call Stack (most recent call first):
/Users/xxx/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake:54 (include)
/Users/xxx/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/android/.cxx/Debug/214s131y/arm64-v8a/CMakeFiles/3.18.1-g262b901/CMakeSystem.cmake:6 (include)
/Users/xxx/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/android/.cxx/Debug/214s131y/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

CMake Error at CMakeLists.txt:13 (add_library):
Cannot find source file:

whisper.cpp/ggml.c
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx

CMake Error at CMakeLists.txt:12 (add_library):
Cannot find source file:

whisper.cpp/whisper.cpp

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx

CMake Error at CMakeLists.txt:13 (add_library):
No SOURCES given to target: ggml

CMake Error at CMakeLists.txt:12 (add_library):
No SOURCES given to target: whisper

CMake Generate step failed. Build files cannot be regenerated correctly.

Thanks a lot for your work!

@Tryad0 Tryad0 changed the title Error - Lexical or Preprocessor Issue Error - Lexical or Preprocessor Issue on whisper_flutter May 21, 2023
@jungti1234
Copy link

I have the same problem.
You can see that it's keep trying to use ndk version 25.1.8937393 and cmake version 3.18.1
even though I update to latest version of ndk and cmake in android studio.

So I tried to check that what is the problem, I found something.

/Users/***/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/android/build.gradle

android {
    // Bumping the plugin compileSdkVersion requires all clients of this plugin
    // to bump the version in their app.
    compileSdkVersion 31

    // Bumping the plugin ndkVersion requires all clients of this plugin to bump
    // the version in their app and to download a newer version of the NDK.
    ndkVersion "25.1.8937393"

    // Invoke the shared CMake build with the Android Gradle Plugin.
    externalNativeBuild {
        cmake {
            path "../src/CMakeLists.txt"

            // The default CMake version for the Android Gradle Plugin is 3.10.2.
            // https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
            //
            // The Flutter tooling requires that developers have CMake 3.10 or later
            // installed. You should not increase this version, as doing so will cause
            // the plugin to fail to compile for some customers of the plugin.
            // version "3.10.2"
        }
    }

There is ndkVersion and cmake version (in comment).
First of all, update ndk and cmake to latest version in Android Studio SDK Manager.
And you can try to change the ndk and cmake version (uncomment it).
After then, no more occur version error.

But, still I'm facing the error "Cannot find source file".

Are there any ideas?

@jungti1234
Copy link

jungti1234 commented Aug 2, 2023

Ok, I finally did it.
You have to download this: https://github.com/ggerganov/whisper.cpp/archive/refs/heads/master.zip
and put whisper.cpp in /Users/***/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/src

It's just quick fix solution, have to figure out how to fix this completely.

@jungti1234
Copy link

For iOS,

  1. make platform :ios, '13.0' in Podfile
  2. (optional) you can this if you got same problem - Specs satisfying the flutter_ffmpeg/https (= 0.3.0) dependency were found, but they required a higher minimum deployment target. tanersener/flutter-ffmpeg#225 (comment)
  3. do flutter clean, flutter get pub
  4. remove '#include "../../src/whisper_flutter.c"' in /Users/***/.pub-cache/hosted/pub.dev/whisper_flutter-0.0.4/ios/Classes/whisper_flutter.cpp
    you can check there is not that exist.
    https://github.com/azkadev/whisper_dart/blob/b8137e802ed26f5124f4a4e4509833272bb71e1f/package/whisper_flutter/ios/Classes/whisper_flutter.cpp#L2

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

No branches or pull requests

2 participants