Look here. Android can't load all needed libraries that your .so library need. So you need to load by your hands.
But if you have header file, but during runtime linking, linker can't find symbol it fails with something like this
Loading some_lib failed java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1285]: 184 cannot locate '_ZN7auf_v136logvlnEbPKcSt9__va_list'...
How can we know where is this symbol? of course with objdump
00000000 l F .text._ZN7auf_v13L7aufExitEv 00000040 _ZN7auf_v13L7aufExitEv
00000000 l d .text._ZN7auf_v13L12initInternalEjj 00000000 .text._ZN7auf_v13L12initInternalEjj
00000000 l F .text._ZN7auf_v13L12initInternalEjj 00000278 _ZN7auf_v13L12initInternalEjj
...
Oh it's here. So one just need link auf.cpp.o with some_lib sources.
Also I found VERY awful thing in bionic loader. Let's look on line 1200. Bionic linker tries to load, if it's fail in next time it just shows
One more thing today. STL and android without standard ndk-build. Many links in google tells that I need add in Android.mk
But if you write your own Makefile you need add path to libs and link STL like
Why it's important??? Bcoz if one use stl, standart android doesnt have stl libs inside and it will fail with error like error from the begin of this message.
Have a nice day))
But if you have header file, but during runtime linking, linker can't find symbol it fails with something like this
Loading some_lib failed java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1285]: 184 cannot locate '_ZN7auf_v136logvlnEbPKcSt9__va_list'...
How can we know where is this symbol? of course with objdump
nika@nika_gt $ /opt/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-objdump -x /tmp/auf.cpp.o | grep auf_v
...00000000 l F .text._ZN7auf_v13L7aufExitEv 00000040 _ZN7auf_v13L7aufExitEv
00000000 l d .text._ZN7auf_v13L12initInternalEjj 00000000 .text._ZN7auf_v13L12initInternalEjj
00000000 l F .text._ZN7auf_v13L12initInternalEjj 00000278 _ZN7auf_v13L12initInternalEjj
...
Oh it's here. So one just need link auf.cpp.o with some_lib sources.
Also I found VERY awful thing in bionic loader. Let's look on line 1200. Bionic linker tries to load, if it's fail in next time it just shows
DL_ERR("%5d '%s' failed to load previously", pid, bname);
really crap. In one big project other team tries to load our .so, it fails without any debug info and after we try to load it, linker shows line like this. I spent some time to debug it =/
One more thing today. STL and android without standard ndk-build. Many links in google tells that I need add in Android.mk
APP_STL := stlport_static
LIBS_PATH += -L/opt/android-ndk-r7/sources/cxx-stl/stlport/libs/armeabi-v7a
LIBS += -lstlport_staticWhy it's important??? Bcoz if one use stl, standart android doesnt have stl libs inside and it will fail with error like error from the begin of this message.
Have a nice day))
No comments:
Post a Comment