Compiling C library for android, but no symbols found

岁酱吖の 提交于 2019-12-01 08:48:06

You have to specify the -D flag to nm if you want it to display dynamic symbols.

You can also use the -T flag to objdump

You should use the versions of nm or objdump provided in the ndk, not any versions which might be found for managing libraries of the development host. These will be found buried far under the toolchains/ folder of the ndk and will have prefixed names something like arm-linux-androideabi-nm

For example, (on a system I haven't used for Android work in a while, so containing a stale version - you will have to use some ingenuity to find what is applicable on your system):

$NDK/android-ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-nm -D mylibrary.so

I got similar issue. You can workaround with a custom build so that -lotherlib gets passed as final argument. For example:

$ /path/to/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc \
--sysroot=/path/to/platforms/android-19/arch-arm \
-L/usr/local/src/lua-5.1.5/src -shared -lm -o mylibrary.so milibrary.o \
-lotherlib

I'm not a C expert so this took me days to figure out :P, not sure why -l should go at the very end...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!