windows 发现动态库对 Mac OS 和 Linux 的依赖
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1057234/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Discovery of Dynamic library dependency on Mac OS & Linux
提问by Viet
On Windows there is a tool Depends.exe to discover dependency of an EXE/DLL file on other DDLs. Which commandline tool is equivalent on Mac OS and Linux?
在 Windows 上,有一个工具 Depends.exe 可以发现 EXE/DLL 文件对其他 DDL 的依赖性。哪个命令行工具在 Mac OS 和 Linux 上等效?
回答by mark4o
- Mac OS X:
otool
-L
file - Linux:
ldd
file
- Mac OS X:
otool
-L
文件 - Linux:
ldd
文件
If those commands don't provide what you want, on Mac OS X you can dump all the load commands with otool
-l
file. On Linux you can dump the entire contents of the dynamic section with readelf
-d
file.
如果这些命令没有提供您想要的,在 Mac OS X 上,您可以使用otool
-l
file转储所有加载命令。在 Linux 上,您可以使用readelf
-d
file转储动态部分的全部内容。
回答by Konrad
You can also try MacDependency (https://github.com/kwin/macdependency) which provides an UI replacement for otool on MacOS X. It shows complete dependency trees and the exported symbols as well.
您还可以尝试 MacDependency ( https://github.com/kwin/macdependency),它为 MacOS X 上的 otool 提供了 UI 替代品。它还显示了完整的依赖树和导出的符号。
回答by chuan
try ldd in the terminal. This will provide you a list of dynamic libraries that the binary needs.
在终端中尝试 ldd。这将为您提供二进制文件所需的动态库列表。