如何列出非本地二进制文件的库依赖关系? [英] How to list library dependencies of a non-native binary?

查看:266
本文介绍了如何列出非本地二进制文件的库依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在为本地平台开发时,我可以使用ldd列出所有共享库(.so文件),我构建的二进制可执行文件将在启动时尝试加载。但是在交叉编译时,我不知道如何获得相同的信息。 ldd 不是普通的binutils工具,例如 strip ar gcc 一起构建,用于交叉编译,相反,它是一个神秘的shell脚本,显然只能在本地平台上运行。

When developing for native platform, I can use ldd to list all the shared libraries (.so files) a binary executable I build will try to load upon start-up. But when cross-compiling, I don't know how to get the same information. The ldd is not a normal binutils utility, like strip or ar, that can be built alongside gcc for cross compiling, but instead, it is a cryptic shell script that apparently can only run on native platform.

因此,使用跨目标binutils工具,是否有任何方法可以获得外部二进制文件的动态链接依赖项列表?

So, using the cross-target binutils tools, is there any way to get a list of the dynamically linked dependency for of a foreign binary?

推荐答案


是否有任何方法可以获取外部二进制文件的动态链接依赖列表

您可以轻松地列出二进制文件的 direct 依赖关系:

You can list direct dependencies of a binary easily enough:

readelf -d a.out | grep NEEDED

 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

我知道无法递归地继续获得完整列表(如 ldd 确实)。您必须手动重复每个需要库的流程。

I know of no way to recursively continue this to get the full list (as ldd does). You'll have to repeat the process for every NEEDED library by hand.

这篇关于如何列出非本地二进制文件的库依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆