usefulsensors / openai-whisper

Robust Speech Recognition via Large-Scale Weak Supervision
MIT License
62 stars 24 forks source link

Android Build Error #42

Open Znerual opened 1 year ago

Znerual commented 1 year ago

Dear Niranjan, thank you so much for sharing this project! It's extremely helpful to have a base on which to build ones ideas and I would love to expand on the android app part of your project. Unfortunately, I can't get your original project to run. I unzipped the android_app folder and opened it in Android Studio. I use Java SDK 11, NDK 21.4 (have also tried 25.1). The gradle build successfully finishes, but when I run the app I get the linker error from the native-lib.cpp:

: && /home/ruzickal/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=x86_64-none-linux-android29 --sysroot=/home/ruzickal/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -frtti -fexceptions -fno-limit-debug-info  -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--gc-sections -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libnative-lib.so -o /home/ruzickal/StudioProjects/android_whisper_app_orig/Whisper-TFLIte-Android-Example/app/build/intermediates/cmake/debug/obj/x86_64/libnative-lib.so CMakeFiles/native-lib.dir/native-lib.cpp.o  /home/ruzickal/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/29/liblog.so /home/ruzickal/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/29/libandroid.so /home/ruzickal/StudioProjects/android_whisper_app_orig/Whisper-TFLIte-Android-Example/app/src/main/cpp/tf-lite-api/generated-libs/x86_64/libtensorflowlite.so -latomic -lm && :

ld: error: undefined symbol: tflite::InterpreterBuilder::operator()(std::__ndk1::unique_ptr<tflite::Interpreter, std::__ndk1::default_delete<tflite::Interpreter> >*)
>>> referenced by native-lib.cpp:254 (/home/ruzickal/StudioProjects/android_whisper_app_orig/Whisper-TFLIte-Android-Example/app/src/main/cpp/native-lib.cpp:254)
>>>               CMakeFiles/native-lib.dir/native-lib.cpp.o:(Java_com_whisper_android_tflitecpp_MainActivity_loadModelJNI)

which indicates that the linker can't find the tflite InterpreterBuilder or has another problem with it. Do you maybe have an idea what could be the problem?

And does anybody else face the same issue and has anyone solved it?

I would greatly appreciate your help! All the best, Laurenz

nyadla-sys commented 1 year ago

looks like libtensorflowlite.so is not linked to the project