alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.37k stars 1.04k forks source link

Vosk on old Android #1490

Closed kercre123 closed 6 months ago

kercre123 commented 6 months ago

The Android libraries in the releases page are (seemingly) compiled with the API 21 compiler, so they should work with Lollipop (5.0) and above, but Vosk only loads correctly in Android 6.0 and above.

I get this error on Android 5.0.2 (armeabi-v7a, Qualcomm 801): java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libvosk.so" needed by "libWirePod.so"; caused by cannot locate symbol "stderr" referenced by "libvosk.so"...

(WirePod is the main program)

I tried compiling with an older API 16 compiler and I got the same error. I also tried using an older NDK (the latest one dropped support for KitKat) and got the same error.

I am using the ./android/lib/build-vosk.sh script. I have modified Kaldi to use rand rather than rand_r, as that gave an undefined error with the older compiler (in the end, I would like to use the older API 16 compiler for KitKat compatibiity).

It seems to be an issue with libf2c.a. It is the only thing I can find which uses the stderr symbol. I guess I could try taking that out, but I would like to know if there are any other things I could try before going deeper into this.

kercre123 commented 6 months ago

I got it working on Lollipop by manually defining stderr, stdin, and stdout in clapack/F2CLIBS/libf2c/err.c. Feels like a bodge, but it works.