如何获取.so文件的依赖项列表? [英] How to get dependencies list for .so file?
问题描述
比方说,我正在为Android(手臂)编译libFoo.so
.我不确定它链接到了什么STL实现(有选项).我如何获取依赖项(如.so列表)以了解应使用System.load(...)/loadLibrary(...)
提供和加载的文件?
Let's say i'm having libFoo.so
compiled for android (arm). I'm not sure what STL implementation it was linked to (there are options). How can i get dependencies (as .so list) for it to understand what files i should provide and load using System.load(...)/loadLibrary(...)
?
推荐答案
您可以使用objdump
工具并过滤掉相关部分.在这种情况下,例如arm-linux-androideabi-objdump -p libFoo.so | grep NEEDED
.
You can use the objdump
tool and filter out the relevant part. In this case, e.g. arm-linux-androideabi-objdump -p libFoo.so | grep NEEDED
.
通常建议的ldd
工具也可以执行此操作,但是它会尝试查找将要加载的所有文件,并且在交叉编译环境中并不总是可用.
The ldd
tool as suggested normally also does this, but it tries to actually find all the files that would be loaded, and it is not always available in cross-compilation environments.
这篇关于如何获取.so文件的依赖项列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!