如何知道ELF需要哪些动态库? [英] How to know which dynamic libraries are needed by an ELF?

查看:227
本文介绍了如何知道ELF需要哪些动态库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何阅读标题的工具会打印出Linux可执行文件所需的动态库的名称?

Is there any tool that reading the headers prints the name of the dynamic libraries required by a Linux executable to run?

我需要知道是否有一些我刚刚从源代码(它是GDB的Python分支)创建的二进制文件中的奇怪的依赖(即不是很标准),或者它主要是静态链接的。我认为比阅读makefile更容易...

I need it to know if there are some weird dependencies (i.e. not very standard) in a binary that I've just built from the source (it's the Python branch of GDB) or it's mostly statically linked. I think that would be easier than reading the makefiles...

推荐答案

/ usr / bin / ldd 是你的朋友。用法:

ldd /bin/ls

样本输出:

linux-vdso.so.1 =>  (0x00007ffd14f79000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f2d875fc000)
libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007f2d873f4000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2d8702f000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f2d86df1000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2d86bed000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2d8781f000)
libattr.so.1 => /lib/x86_64-linux-gnu/libattr.so.1 (0x00007f2d869e8000)

这篇关于如何知道ELF需要哪些动态库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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