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

Support 16kb page size in Android build #37

Closed
DrKappa79 opened this issue Jan 6, 2025 · 8 comments
Closed

Support 16kb page size in Android build #37

DrKappa79 opened this issue Jan 6, 2025 · 8 comments

Comments

@DrKappa79
Copy link

Hi, with the release of Android 15 native code should support 16kb page size on arm64-v8a target.

The steps required should be:

  • update AGP to at least 8.5 (latest is 8.7.3)
  • update NDK to r28 (right now it's a release candidate, latest stable is r27c which requires an additional command)
  • if using r27 add the additional command in Application.mk (APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true)

This should produce native code which is aligned to 16kb pages.

This is what i got for a release build I did last year from version 20.0.0:

LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**12
LOAD off    0x00000000003294d8 vaddr 0x000000000032a4d8 paddr 0x000000000032a4d8 align 2**12

Which is NOT aligned to 16kb pages. As per documentation:

Check the output lines to ensure that the load segments don't have values less than 2**14.
If any load segments are 2**13, 2**12, or lower values, you'll need to update the packaging for those libraries,
then recompile your app and retest.

I've been running a test against Libbulletjme version 21.3.2 using:

  • AGP 8.7.0
  • NDK 27.2.12479018
  • gradle 8.11
  • compileSdkVersion set to API 35
  • targetSdkVersion set to API 35

This is what I get with the build I did today:

LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**14
LOAD off    0x0000000000362080 vaddr 0x0000000000366080 paddr 0x0000000000366080 align 2**14
LOAD off    0x0000000000377150 vaddr 0x000000000037f150 paddr 0x000000000037f150 align 2**14

It seems properly aligned but unfortunately I cannot quickly verify this works on a 16kb page emulator as I have more native dependencies to update on that project and I am also afraid the API changes between 20.0.0 and 21.3.2 might require some rework on my code.

@stephengold
Copy link
Owner

Thanks for the detailed information about this issue.

My process for deploying Android binaries is currently broken due to issues at Travis CI. I hope to put new build procedures in place soon, but I don't know how long that will take.

@DrKappa79
Copy link
Author

I think in the next few days I should be able to test the project on 16kb page emulators (both x86-64 and arm64-v8a).
I also have a workflow that uses V-HACD to simplify a mesh running on an Android device so that's an extra test.

If you want I can keep you posted.

@stephengold
Copy link
Owner

I'd like to stay in touch. I'd be interested in any further issues you uncover.

@stephengold
Copy link
Owner

The steps required should be

I've made the required changes in the public repo.

I've been running a test against Libbulletjme version 21.3.2

21.3.2 was a failed build. The last successful build was 21.2.1 .

@DrKappa79
Copy link
Author

21.3.2 was a failed build. The last successful build was 21.2.1 .

I did not try the 21.3.2 binaries just got the source code from that release.

Anyhow I got the latest version and these are the results for arm64-v8a.

Debug build:

LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**14
LOAD off    0x00000000005a94b0 vaddr 0x00000000005ad4b0 paddr 0x00000000005ad4b0 align 2**14
LOAD off    0x00000000005cc2e8 vaddr 0x00000000005d42e8 paddr 0x00000000005d42e8 align 2**14

Release build:

LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**14
LOAD off    0x0000000000362080 vaddr 0x0000000000366080 paddr 0x0000000000366080 align 2**14
LOAD off    0x0000000000377150 vaddr 0x000000000037f150 paddr 0x000000000037f150 align 2**14

They seem ok to me. As soon as I can build the other dependencies for my app I will try the libraries and let you know.

ps I forgot I had to make another small change on Windows (this was also needed for version 20.0.0), will open a specific issue.

@DrKappa79
Copy link
Author

DrKappa79 commented Jan 18, 2025

Hi,

I managed to update dependencies and run a test on my app running on a x86-64 emulator with 16kb pages.

The old version would crash when loading the .so file as expected.
The new one properly loads the library and runs without any apparent issue.

Also reverted to a x86-64 emulator with 4kb pages and the new build is fine.

Will check on both arm64-v8a emulators (16kb and 4kb) tomorrow and let you know if there are any issues.

ps I just updated libbulletjme java source code and the native libraries and I was lucky I did not have to change the app code.

Image

@stephengold
Copy link
Owner

Thanks for the update. Let me know when I should close this issue.

@DrKappa79
Copy link
Author

The libraries also work on a 16kb pages Arm64-v8a emulator.

I think you can close the issue.

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

2 participants