NDK r10 b 32 bit or 64 bit or compile using both and how to achieve it

When I ndk compile the project using r10b 64 bit builder it compiles without issue

I can successfully run the project in Lollipop and the application starts as it should be

But when I run the project in JellyBean at runtime I get the following error

failed to load library "libopenvpn.so" required "/data/data/de.blinkt.openvpn/cache/pievpn.armeabi-v7a"; called soinfo_relocate (linker.cpp: 987): cannot find symbol "srandom" refers to "libopenvpn.so" ... CANNOT LIST EXECUTELY

so when I researched I found because of using 64 builder and solution, 32 bit builder needs to be used.

When I use 32 builder I get the following error during compilation itself.

Android NDK: NDK Application "local" targets unknown ABI (s): arm64-v8a x86_64 Android NDK: Correct APP_ABI definition in. /jni/Application.mk
/Users/ShajilShocker/Documents/Android/NDK/android-ndk-r10b/build/core/setup-app.mk:112: *** Android NDK: Cancel. Stop.

So if I omit arm64-v8a and x86_64 then it will probably compile, but it won't work on 64-bit devices.

Is it possible that I can compile the same project using 32-bit (commenting on 64 architectures) first and compile using 64-bit (uncomment 64 architectures) and run them on both.

Any help is greatly appreciated!

Thank!

+3


source to share


2 answers


64-bit ARM and X86 devices (not sure about MIPS) running Lollipop can run 32 or 64-bit native code (ARMv7a / ARMv8 and X86 / X64). Android allows you to link native code libraries with multiple ABIs (processor specific code) in an APK. They are also called FAT binaries. For example, to create a binary FAT file containing both ARMv7a and ARMv8 code, add the following line to the Application.mk file:

APP_ABI := arm64-v8a armeabi-v7a

      

Then, in your Android.mk file, you can add specific settings for each CPU type:



ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
<your custom ARM 32-bit build instructions here>
endif

ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
<your custom ARM 64-bit build instructions here>
endif

      

When you run your bold binary containing both 32 and 64 bit code on a 32 bit system, it will load the 32 bit code and vice versa. In code, it should not be necessary to compile code for every target device. What the purpose of a live binary is - the system will automatically load a library suitable for the target architecture.

+4


source


You should be using NDK Revision 10c for at least 64 bit support, according to the official documentation, https://developer.android.com/about/versions/android-5.0-changes.html#64BitSupport .



0


source







All Articles