内容简介:linux下,我们通常使用ldd命令查看可执行文件依赖了哪些动态库,以及程序运行时,这些动态库的位置。比如我在我的centos测试服务器上查看nginx依赖的动态库:MacOS没有ldd,可以通过
linux下,我们通常使用ldd命令查看可执行文件依赖了哪些动态库,以及程序运行时,这些动态库的位置。
比如我在我的centos测试服务器上查看nginx依赖的动态库:
$ldd /usr/sbin/nginx linux-vdso.so.1 => (0x00007ffe685de000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fd364073000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd363e57000) libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fd363c20000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fd3639be000) libssl.so.10 => /lib64/libssl.so.10 (0x00007fd36374c000) libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fd3632eb000) libz.so.1 => /lib64/libz.so.1 (0x00007fd3630d5000) libprofiler.so.0 => /lib64/libprofiler.so.0 (0x00007fd362ec1000) libc.so.6 => /lib64/libc.so.6 (0x00007fd362af4000) /lib64/ld-linux-x86-64.so.2 (0x00007fd3645a8000) libfreebl3.so => /lib64/libfreebl3.so (0x00007fd3628f1000) libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fd3626a4000) libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fd3623bb000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fd3621b7000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fd361f84000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd361c7d000) libm.so.6 => /lib64/libm.so.6 (0x00007fd36197b000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd361765000) libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fd361555000) libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fd361351000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fd361138000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fd360f11000)
MacOS没有ldd,可以通过 otool -L
命令达到统一的效果,比如:
$otool -L /usr/local/go/bin/go /usr/local/go/bin/go: /usr/lib/libSystem.B.dylib (compatibility version 0.0.0, current version 0.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 0.0.0, current version 0.0.0) /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 0.0.0, current version 0.0.0)
以及:
$otool -L /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg: /usr/local//lib/libavdevice.57.dylib (compatibility version 57.0.0, current version 57.10.100) /usr/local//lib/libavfilter.6.dylib (compatibility version 6.0.0, current version 6.107.100) /usr/local//lib/libavformat.57.dylib (compatibility version 57.0.0, current version 57.83.100) /usr/local//lib/libavcodec.57.dylib (compatibility version 57.0.0, current version 57.107.100) /usr/local//lib/libpostproc.54.dylib (compatibility version 54.0.0, current version 54.7.100) /usr/local//lib/libswresample.2.dylib (compatibility version 2.0.0, current version 2.9.100) /usr/local//lib/libswscale.4.dylib (compatibility version 4.0.0, current version 4.8.100) /usr/local//lib/libavutil.55.dylib (compatibility version 55.0.0, current version 55.78.100) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1259.0.0) /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0) /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1258.1.0) /System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57337.60.2) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1) /usr/lib/liblzma.5.dylib (compatibility version 6.0.0, current version 6.3.0) /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 728.13.0) /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 600.0.0) /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage (compatibility version 1.0.1, current version 2.0.0) /System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0) /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 492.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1404.47.0)
参考链接:
- https://man.linuxde.net/ldd
- https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/ldd.html
- https://discussions.apple.com/thread/309193
本文完,作者 yoko ,尊重劳动人民成果,转载请注明原文出处: https://pengrl.com/p/20047/
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- .NET 使用 ILRepack 合并多个程序集(替代 ILMerge),避免引入额外的依赖
- Postwoman 替代 Postman
- JSX的替代品[译]
- [译]JSX的替代品
- fetch使用,ajax替代方案
- sharedata 的替代品:datasheet
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
XML、JSON 在线转换
在线XML、JSON转换工具
HSV CMYK 转换工具
HSV CMYK互换工具