google / oboe

Oboe is a C++ library that makes it easy to build high-performance audio apps on Android.
Apache License 2.0
3.72k stars 573 forks source link

Builds with 16 KB page size #2041

Closed NLLAPPS closed 4 weeks ago

NLLAPPS commented 5 months ago

Hi, as per https://developer.android.com/guide/practices/page-sizes, are there any plans to provide builds with 16 KB page size? If so, are you able to provide timeline? Thank you

philburk commented 5 months ago

We will investigate this.

You could build Oboe from source by cloning the GitHub repo. Then you could set the build options as you with.

philburk commented 5 months ago

Thanks for the question. We have reviewed the docs that you linked to. It seems that if we build Oboe using 16 KB alignment then it will also work for 4 KB.

We are considering adding this line to our Oboe prebuilt script:

target_link_options(${CMAKE_PROJECT_NAME} PRIVATE "-Wl,-z,max-page-size=16384")

@NLLAPPS - Would that help you?

What is the impact if we do not do that? Does it mean that you would not be able to use Oboe on a 16KB aligned device?!

NLLAPPS commented 5 months ago

Hi, I was able to build by adding -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON to build_all_android.sh instead of target_link_options(${CMAKE_PROJECT_NAME} PRIVATE "-Wl,-z,max-page-size=16384")

-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON seems to be only available on ndk-r27-beta2+ and tell ndk to only use 16KB page size on x64 abis

Impact of not building 16KB seems to be that next year Google Play will start to refuse updates if your app has native binaries without 16KB page sizes. Article linked says "...We plan to make 16 KB page compatibility required for app uploads to the Google Play store next year..."

philburk commented 5 months ago

Thanks for the info. I appreciate you sharing your knowledge.

I think -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON is the way to go. But we should not make our prebuilt using a Beta NDK.

Maybe we can declare -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON for now and it will just be ignored by older NDK versions. Then when NDK-r27 is released it will take effect and we can spin a new Oboe release.

We can tell any developer that wants 16KB support to make sure they are using an NDK-r27 or later release.

robertwu1 commented 4 weeks ago

See #2084

You should add target_link_options(oboetester PRIVATE "-Wl,-z,max-page-size=16384") and upgrade gradle.