maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
1.03k stars 300 forks source link

Compile for Android with support for 16 KB page sizes #2429

Closed louwers closed 2 weeks ago

louwers commented 4 months ago

Beginning with Android 15, Android supports devices that are configured to use a page size of 16 KB (16 KB devices). If your app uses any NDK libraries, either directly or indirectly through an SDK, then you will need to rebuild your app for it to work on these 16 KB devices.

https://developer.android.com/about/versions/15/behavior-changes-all#16-kb

We need to push out a new 11.x.x release and probably also 10.x.x since some people still on the 10.x.x series will want support.

louwers commented 4 months ago

If your app dynamically links to the C++ standard library (libc++_shared.so) from Android NDK r26 or lower, then it is recommended to move to Android NDK r27 or higher to update to the 16 KB ELF aligned version of the C++ standard library. Otherwise, your app will fail to install on 16 KB devices.

Do we dynamically link to the C++ standard library on Android?

Edit: I don't think so.

/Users/bart/Library/Android/sdk/ndk/26.3.11579264/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readelf -d libmaplibre.so
Dynamic section at offset 0xa064b0 contains 34 entries:
  Tag                Type           Name/Value
  0x0000000000000001 (NEEDED)       Shared library: [libEGL.so]
  0x0000000000000001 (NEEDED)       Shared library: [libGLESv3.so]
  0x0000000000000001 (NEEDED)       Shared library: [libandroid.so]
  0x0000000000000001 (NEEDED)       Shared library: [libjnigraphics.so]
  0x0000000000000001 (NEEDED)       Shared library: [liblog.so]
  0x0000000000000001 (NEEDED)       Shared library: [libz.so]
  0x0000000000000001 (NEEDED)       Shared library: [libm.so]
  0x0000000000000001 (NEEDED)       Shared library: [libdl.so]
  0x0000000000000001 (NEEDED)       Shared library: [libc.so]
  0x000000000000000e (SONAME)       Library soname: [libmaplibre.so]
  0x000000000000001e (FLAGS)        BIND_NOW 
  0x000000006ffffffb (FLAGS_1)      NOW 
  0x0000000000000007 (RELA)         0x21a038
  0x0000000000000008 (RELASZ)       469248 (bytes)
  0x0000000000000009 (RELAENT)      24 (bytes)
  0x000000006ffffff9 (RELACOUNT)    11109
  0x0000000000000017 (JMPREL)       0x28c938
  0x0000000000000002 (PLTRELSZ)     55008 (bytes)
  0x0000000000000003 (PLTGOT)       0xa10008
  0x0000000000000014 (PLTREL)       RELA
  0x0000000000000006 (SYMTAB)       0x2f8
  0x000000000000000b (SYMENT)       24 (bytes)
  0x0000000000000005 (STRTAB)       0x5b810
  0x000000000000000a (STRSZ)        1828903 (bytes)
  0x000000006ffffef5 (GNU_HASH)     0x3aad8
  0x0000000000000004 (HASH)         0x49830
  0x0000000000000019 (INIT_ARRAY)   0xa071a0
  0x000000000000001b (INIT_ARRAYSZ) 784 (bytes)
  0x000000000000001a (FINI_ARRAY)   0xa07190
  0x000000000000001c (FINI_ARRAYSZ) 16 (bytes)
  0x000000006ffffff0 (VERSYM)       0x36280
  0x000000006ffffffe (VERNEED)      0x3aa78
  0x000000006fffffff (VERNEEDNUM)   3
  0x0000000000000000 (NULL)         0x0
tylerjroach commented 2 weeks ago

Has this effort started yet? Android 15 has now been released, and although its unlikely that manufacturers immediately default to 16 KB page sizes, Pixel devices will be able to easily switch to 16KB page sizes with a developer options setting. Tracking this change as we have a library that will rely on maplibre 16KB page size support.

louwers commented 2 weeks ago

@tylerjroach Thanks for the reminder, I will prioritize working on this.