whisper_android icon indicating copy to clipboard operation
whisper_android copied to clipboard

Compatibility with 16KB devices

Open KiwiWilkinson opened this issue 4 months ago • 8 comments

When compiling whisper_native in Android Studio Narwhal Patch 1 I get the following error:

Image

Do I need to do something to make it compatible with 16KB page sizes, or does that need to happen at the repo end?

Cheers,

KiwiWilkinson avatar Aug 27 '25 15:08 KiwiWilkinson

Can you try whisper_java?

vilassn avatar Aug 28 '25 07:08 vilassn

Thanks Vilas. Same thing:

Image

My limited understanding is that libtensorflowlite_jni.so and the other .so files need recompiling with clang flags to support 16kB page sizes

KiwiWilkinson avatar Aug 29 '25 11:08 KiwiWilkinson

If you compile whisper_java, it will fetch prebuilt library libtensorflowlite_jni.so from gradle repo. You can try changing library version in dependency list.

vilassn avatar Aug 29 '25 11:08 vilassn

Thanks. The problem seems to be that that pre-built library doesn't support 16kB page sizes. So the new Android restriction will stop it being used in apps.

KiwiWilkinson avatar Aug 29 '25 11:08 KiwiWilkinson

The issue remains after updating to org.tensorflow:tensorflow-lite:2.17.0 and org.tensorflow:tensorflow-lite-support:0.5.0

I don't understand tensorflow at all, or .so files. Is there a way of getting an .so file that's compiled for 16kB pages?

KiwiWilkinson avatar Aug 29 '25 12:08 KiwiWilkinson

The libtensorflowlite.so file is being picked up from your repo here: whisper_native/app/src/main/cpp/tf-lite-api/generated-libs/arm64-v8a

Is it possible to replace it with a new version that supports 16kB page sizes?

KiwiWilkinson avatar Aug 30 '25 13:08 KiwiWilkinson

Hi @KiwiWilkinson , I see in latest update #38 @yong1020 has shared the libs.

vilassn avatar Sep 05 '25 10:09 vilassn

Thanks Vilas.

I also needed to change a couple of things in the project to get other .so files to be 16BK aligned:

  • libaudioEngine.so: I added set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=16384") to whispernative\src\main\cpp\makelists.txt

  • libtensorflowlite_jni.so I changed the dependencies in build.gradle to: implementation 'org.tensorflow:tensorflow-lite:2.17.0' implementation 'org.tensorflow:tensorflow-lite-support:0.5.0'

If you're going to release a new version of Whisper to include the new libtensorflowlite.so, then you probably want to make these changes as well.

KiwiWilkinson avatar Sep 06 '25 11:09 KiwiWilkinson