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

Does "whisper-stream" work on Android devices? Encounter error " ld.lld: error: undefined symbol: main " #2727

Open
Jin-2157 opened this issue Jan 13, 2025 · 0 comments

Comments

@Jin-2157
Copy link

Does "whisper-stream" work on Android devices?
Encounter error " ld.lld: error: undefined symbol: main "

I want the compiler to run an instance of the microphone input language on Android, compile the command as follows:

''' shell
BUILD_DIR=build-android
INSTALL_DIR=install_dir

rm -rf ${BUILD_DIR}
cmake
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake
-DANDROID_ABI=arm64-v8a
-DANDROID_PLATFORM=android-28
-DCMAKE_C_FLAGS="-march=armv8.7a"
-DCMAKE_CXX_FLAGS="-march=armv8.7a"
-DGGML_OPENMP=OFF
-DGGML_LLAMAFILE=OFF
-B ${BUILD_DIR}
-DWHISPER_SDL2=ON -DSDL2_DIR=/home/SDL2-2.28.4/build_arm64/_install/lib/cmake/SDL2

cd ${BUILD_DIR} ; make VERBOSE=1 whisper-stream -j20 |tee MAKE.log ; cd -
'''

Error encountered SDL2 library:

''' shell
......
[100%] Linking CXX executable ../../bin/whisper-stream
cd /home/whisper.cpp/build_22-android/examples/stream && /home/cmake-3.26.0-linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/whisper-stream.dir/link.txt --verbose=1
/home/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android28 --sysroot=/home/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -march=armv8.7a -O3 -DNDEBUG -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -Wl,--gc-sections "CMakeFiles/whisper-stream.dir/stream.cpp. o" -o ../.. /bin/whisper-stream ../libcommon. a ../libcommon-sdl. a ../../src/libwhisper. so -pthread ../../ggml/src/libggml. so ../../ggml/src/libggml-cpu. so ../../ggml/src/libggml-base. so /home/SDL2-2.28.4/build_arm64/_install/lib/libSDL2main. a /home/SDL2-2.28.4/build_arm64/_install/lib/libSDL2. a -lm -lOpenSLES -ldl -llog -landroid -lGLESv1_CM -lGLESv2 -latomic -lm
ld.lld: error: undefined symbol: main

referenced by crtbegin.c
/home/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/28/crtbegin_dynamic.o:(_start_main)
referenced by crtbegin.c
/home/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/28/crtbegin_dynamic.o:(_start_main)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

'''

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

1 participant