telyThank you very much, Chris!
Presumably in the same place as the native library which is calling
dlopen()....
This was my initial thought too, but dlopen fails to open the library if I use "simplelib" or "./libsimplelib.so" or just about any variation you can think up...
You were already given a java solution, which sounds good.
I have a c++ application I wish to run, although I understand that a native-activity inherits a java vm instance; this might lead to a solution if I can figure out how to use its properties.
If you really want to avoid that, I suppose you can troll your own
maps and figure out where you were loaded from.
I believe you are correct: I'll add some code to the native-activity library to probe the filesystem.
Another possibility is that this extra library is not getting
installed,
Your hypothesis fits the experimental data. Although I know for a fact that libsimplelib.so winds up in the package, does it actually get installed? I will write more code to see.
perhaps because it is not a compatible ABI
It is, both modules are built compatibly:
The application (libnative-activity.so) is built for ARM android-9 and runs correctly.
It then it tries to dlopen libsimplelib.so which is built for ARM android-3
Here are the compile and link phases for native-activity:
/opt/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi/objs/native-activity/main.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/opt/android-ndk-r8/sources/android/native_app_glue -Ijni -DANDROID -Wa,--noexecstack -O2 -DNDEBUG -g -I/opt/android-ndk-r8/platforms/android-9/arch-arm/usr/include -c jni/main.c -o ./obj/local/armeabi/objs/native-activity/main.o
/opt/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ -Wl,-soname,libnative-activity.so -shared --sysroot=/opt/android-ndk-r8/platforms/android-9/arch-arm ./obj/local/armeabi/objs/native-activity/main.o ./obj/local/armeabi/libandroid_native_app_glue.a -Wl,--no-undefined -Wl,-z,noexecstack -L/opt/android-ndk-r8/platforms/android-9/arch-arm/usr/lib -llog -landroid -lEGL -lGLESv1_CM -ldl -llog -lc -lm -o obj/local/armeabi/libnative-activity.so
For simplelib:
/opt/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi/objs/simplelib/__/src/libmain.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Ijni/../inc -I../include -Ijni -DANDROID -Wa,--noexecstack -O2 -DNDEBUG -g -I/opt/android-ndk-r8/platforms/android-3/arch-arm/usr/include -c jni/../src/libmain.c -o ./obj/local/armeabi/objs/simplelib/__/src/libmain.o
/opt/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ -Wl,-soname,libsimplelib.so -shared --sysroot=/opt/android-ndk-r8/platforms/android-3/arch-arm ./obj/local/armeabi/objs/simplelib/__/src/libmain.o -Wl,--no-undefined -Wl,-z,noexecstack -lc -lm -o obj/local/armeabi/libsimplelib.so
They are identical except for the ABI, but since the running ABI is 9, it should work, right?
It might be worth building a debuggable apk so
Noted! Since I am a command-line user it'll probably be very interesting getting that working ;-)
I normally use DDD, I hope I can use it here.
you can use the run-as command in the adb shell to get a shell as the
app userid and look around in it's private files to see what libs
actually did get unpacked.
I did not know about this facility. I will read. Thank you!