Repository navigation
Support building native libraries with Android NDK 18+ - #1744
BugsBeGone wants to merge 1 commit into
Conversation
|
Forgot to mention, I have no opinion whatsoever about whether the shipped binaries should actually be upgraded or not, I understand that testing anything like this is extremely tedious at the best of times. This is purely intended to help those wanting to build jnidispatch.so from source, who may at some point be unable to use or even obtain ancient NDK toolchains. |
matthiasblaesing
left a comment
There was a problem hiding this comment.
Thank you. The changes make sense to me. For the change to the build instructions for Android please update to this:
Sample build
------------
NDKs with version > 16
```bash
export NDK=/home/matthias/Android/Sdk/ndk/30.0.16248370
export NDK_PLATFORM=21
export PATH=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH
ant -Dos.prefix=android-aarch64
ant -Dos.prefix=android-armv7
ant -Dos.prefix=android-x86-64
ant -Dos.prefix=android-x86
```
NDKs with version <= 16
```bash
export NDK=/home/matthias/bin/android-ndk-r12b/
export NDK_PLATFORM=21
export PATH=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/:$PATH
export PATH=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/:$PATH
export PATH=$NDK/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64/bin/:$PATH
export PATH=$NDK/toolchains/mipsel-linux-android-4.9/prebuilt/linux-x86_64/bin/:$PATH
export PATH=$NDK/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/:$PATH
export PATH=$NDK/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/:$PATH
ant -Dos.prefix=android-aarch64
ant -Dos.prefix=android-armv7
ant -Dos.prefix=android-arm
ant -Dos.prefix=android-mips64
ant -Dos.prefix=android-mips
ant -Dos.prefix=android-x86-64
ant -Dos.prefix=android-x86
```
I tested with 27c and build succeeded. I tested building with 12b and got bit identical results compared to the current binaries.
While it is great to be able to build with recent NDKs, I have no plans to switch. We loose platforms without clear benefits.
Backwards compatible changes to native makefile, such that ancient GCC-based toolchains can still be used, but also allow newer LLVM-based tools from NDK 18 onwards.
When building with anything available from the Android SDK manager currently, all that should be necessary is to set
$NDKto the top-level path, and$NDK_PLATFORMto the target SDK level. If noPkg.Revisioncan be found, you will also need to set$NDK_VERto the major version.Checks for armv5 & MIPS target architectures are also performed, which are not supported from NDK 17,