Why can't I use the pre-built library from AndroidNDK on rapsberrypi4?

Viewed 113

Maybe I'm doing it the wrong way, but I haven't learned otherwise. The bottom line is that I decided to build a program that links with libOpenSLES.so (a library from AndroidNDK) natively to raspberrypi4.

My operating system on raspberry pi: Debian bullseye armhf.

uname -ar

Linux guardian 5.10.52-v7l + # 1441 SMP Tue Aug 3 18:11:56 BST 2021 armv7l GNU / Linux

To do this, I copied the library and header files from the Android NDK directly into my environment.

ls /usr/include/SLES

OpenSLES.h OpenSLES_AndroidConfiguration.h OpenSLES_Platform.h
OpenSLES_Android.h OpenSLES_AndroidMetadata.h

file /usr/lib/libOpenSLES.so

/usr/lib/libOpenSLES.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID [md5 / uuid] = ee43a7abfd4e7dd27b03b0c97b80b768, with debug_info, not stripped
The description is the same for all other libraries in the system.

The program built without errors with the link key -lOpenSLES, but upon startup it gives an error when loading this library

E: [pulseaudio] ltdl-bind-now.c: Failed to open module /home/pulseaudio-android/testbuild/src/.libs/module-opensles.so: libOpenSLES.so: cannot open shared object file: No such file or directory

And at the same time, ldd does not work out correctly

ldd /usr/lib/libOpenSLES.so not a dynamic executable

I tried ldd for all libraries supplied in AndroidNDK

find ./android-ndk-r23b -name libOpenSLES.so | grep androideabi | xargs ldd

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/26/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/29/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/31/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/27/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/24/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/18/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/19/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/23/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/28/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/22/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/16/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/30/libOpenSLES.so:
not a dynamic executable

./android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/17/libOpenSLES.so:

Thanks for the help.

1 Answers

Sorry, the question has been cleared. The Android NDK supplies stub libraries that are only for linking, they do not contain any code for execution. Real libraries come with a real Android device.

Thanks.

Related