查看可执行文件依赖的动态库 ldd

在LINUX平台下 可以通过 ldd + 可执行程序 查看 可执行程序依赖的动态库

例如:


hemai@hemai-500-020cx:~/qt-pro/test/build-books-Desktop_Qt_5_5_1_GCC_64bit-Debug$ ldd books

    linux-vdso.so.1 =>  (0x00007fffee387000)
    libQt5Widgets.so.5 => /home/hemai/Qt5.5.1/5.5/gcc_64/lib/libQt5Widgets.so.5 (0x00007f730867c000)
    libQt5Gui.so.5 => /home/hemai/Qt5.5.1/5.5/gcc_64/lib/libQt5Gui.so.5 (0x00007f7307e6a000)
    libQt5Sql.so.5 => /home/hemai/Qt5.5.1/5.5/gcc_64/lib/libQt5Sql.so.5 (0x00007f7307c2a000)
    libQt5Core.so.5 => /home/hemai/Qt5.5.1/5.5/gcc_64/lib/libQt5Core.so.5 (0x00007f73074e4000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f73071e0000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7306fca000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7306c01000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f73069e3000)
    libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f7306792000)
    libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f7306590000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7306388000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f7306080000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f7305e6e000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f7305b39000)
    libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f73058d3000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f73055cd000)
    libicui18n.so.54 => /home/hemai/Qt5.5.1/5.5/gcc_64/lib/libicui18n.so.54 (0x00007f730515f000)
    libicuuc.so.54 => /home/hemai/Qt5.5.1/5.5/gcc_64/lib/libicuuc.so.54 (0x00007f7304db1000)
    libicudata.so.54 => /home/hemai/Qt5.5.1/5.5/gcc_64/lib/libicudata.so.54 (0x00007f7303387000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7303183000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7308efb000)
    libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f7302f7b000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f7302d3d000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f7302b1e000)
    libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f73028f7000)
    libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f73026f4000)
    libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f73024ee000)
    libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f73022ec000)
    libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f73020d5000)
    libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f7301ed0000)
    libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f7301ccd000)
    libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f7301aca000)
    libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f73018c4000)
    libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f73016c2000)
    libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f73014bc000)
    libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f73012ae000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f73010aa000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f7300ea4000)
hemai@hemai-500-020cx:~/qt-pro/test/build-books-Desktop_Qt_5_5_1_GCC_64bit-Debug$ 

在嵌入式上面 没有ldd命令 取而代之的是

CC=$(CROSS_COMPILE // 交叉编译器)gcc

LDD=$(CROSS_COMPILE)readelf

例如

Dynamic section at offset 0xa580 contains 35 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libQt5Widgets.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5Gui.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5Sql.so.5]
 0x00000001 (NEEDED)                     Shared library: [libQt5Core.so.5]
 0x00000001 (NEEDED)                     Shared library: [libGLESv2.so.2]
 0x00000001 (NEEDED)                     Shared library: [libEGL.so.1]
 0x00000001 (NEEDED)                     Shared library: [libGAL.so]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0x14544
 0x0000000d (FINI)                       0x18e8c
 0x00000019 (INIT_ARRAY)                 0x2a350
 0x0000001b (INIT_ARRAYSZ)               8 (bytes)
 0x0000001a (FINI_ARRAY)                 0x2a358
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x00000004 (HASH)                       0x10194
 0x00000005 (STRTAB)                     0x11ac0
 0x00000006 (SYMTAB)                     0x10c30
 0x0000000a (STRSZ)                      8538 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x2a6c0
 0x00000002 (PLTRELSZ)                   1680 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x13eb4
 0x00000011 (REL)                        0x13e6c
 0x00000012 (RELSZ)                      72 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x13dec
 0x6fffffff (VERNEEDNUM)                 3
 0x6ffffff0 (VERSYM)                     0x13c1a
 0x00000000 (NULL)                       0x0




你可能感兴趣的:(ubuntu)