zoukankan      html  css  js  c++  java
  • [转]Android下怎么使用LDD查看依赖库

     

    Android下没有ldd可以使用,在进行ndk开发的时候,检查库的依赖项特别麻烦。有两个解决方案:

    1、将linux的的ldd移植过去。因为android也是基于linux的,所以将ldd移植过去是完全可能的,google一下吧,这不是本文的重点;

    2、现成的。ndk已经提供了工具,在ubuntu下执行locate readelf,你会发现有这些输出:

    /mydroid/external/elfutils/src/readelf.c

    /mydroid/prebuilt/darwin-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-readelf

    /mydroid/prebuilt/darwin-x86/toolchain/arm-eabi-4.2.1/man/man1/arm-eabi-readelf.1

    /mydroid/prebuilt/darwin-x86/toolchain/arm-eabi-4.3.1/bin/arm-eabi-readelf

    /mydroid/prebuilt/darwin-x86/toolchain/arm-eabi-4.3.1/man/man1/arm-eabi-readelf.1

    /mydroid/prebuilt/darwin-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-readelf

    /mydroid/prebuilt/darwin-x86/toolchain/arm-eabi-4.4.0/man/man1/arm-eabi-readelf.1

    /mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-readelf

    /mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/man/man1/arm-eabi-readelf.1

    /mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/arm-eabi-readelf

    /mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/man/man1/arm-eabi-readelf.1

    /mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-readelf

    /mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/man/man1/arm-eabi-readelf.1

    /mydroid/prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu-readelf

    /mydroid/prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1/man/man1/i686-unknown-linux-gnu-readelf.1

    /mydroid/prebuilt/linux-x86/toolchain/sh-4.3.3/bin/sh-linux-gnu-readelf

    /usr/android/android-ndk-r4b/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-readelf

    /usr/android/android-ndk-r4b/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-readelf

    /usr/bin/readelf

    /usr/share/man/man1/readelf.1.gz

    加粗的部分就是你可以使用的工具了。

    测试一下:

    当你完成android的编译后,测试如下:

    root@dylan-ubuntu:/mydroid/out/target/product/generic/system/bin# /usr/android/android-ndk-r4b/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-readelf -d test_pvauthorengine

    Dynamic section at offset 0x20b00 contains 26 entries:

      Tag        Type                         Name/Value

     0x00000001 (NEEDED)                     Shared library: [libopencore_author.so]

     0x00000001 (NEEDED)                     Shared library: [libopencore_common.so]

     0x00000001 (NEEDED)                     Shared library: [libdl.so]

     0x00000001 (NEEDED)                     Shared library: [libc.so]

     0x00000001 (NEEDED)                     Shared library: [libstdc++.so]

     0x00000001 (NEEDED)                     Shared library: [libm.so]

     0x00000020 (PREINIT_ARRAY)              0x28000

     0x00000021 (PREINIT_ARRAYSZ)            0x8

     0x00000019 (INIT_ARRAY)                 0x28008

     0x0000001b (INIT_ARRAYSZ)               8 (bytes)

     0x0000001a (FINI_ARRAY)                 0x28010

     0x0000001c (FINI_ARRAYSZ)               8 (bytes)

     0x00000004 (HASH)                       0x8108

     0x00000005 (STRTAB)                     0x8fb0

     0x00000006 (SYMTAB)                     0x85a0

     0x0000000a (STRSZ)                      4570 (bytes)

     0x0000000b (SYMENT)                     16 (bytes)

     0x00000015 (DEBUG)                      0x0

     0x00000003 (PLTGOT)                     0x28bf8

     0x00000002 (PLTRELSZ)                   1144 (bytes)

     0x00000014 (PLTREL)                     REL

     0x00000017 (JMPREL)                     0xa19c

     0x00000011 (REL)                        0xa18c

     0x00000012 (RELSZ)                      16 (bytes)

     0x00000013 (RELENT)                     8 (bytes)

     0x00000000 (NULL)                       0x0

    root@dylan-ubuntu:/mydroid/out/target/product/generic/obj/lib# /usr/android/android-ndk-r4b/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-readelf -d libopencore_common.so

    Dynamic section at offset 0xcc448 contains 36 entries:

      Tag        Type                         Name/Value

     0x00000001 (NEEDED)                     Shared library: [libutils.so]

     0x00000001 (NEEDED)                     Shared library: [libcutils.so]

     0x00000001 (NEEDED)                     Shared library: [libui.so]

     0x00000001 (NEEDED)                     Shared library: [libhardware.so]

     0x00000001 (NEEDED)                     Shared library: [libandroid_runtime.so]

     0x00000001 (NEEDED)                     Shared library: [libdrm1.so]

     0x00000001 (NEEDED)                     Shared library: [libmedia.so]

     0x00000001 (NEEDED)                     Shared library: [libskia.so]

     0x00000001 (NEEDED)                     Shared library: [libvorbisidec.so]

     0x00000001 (NEEDED)                     Shared library: [libsonivox.so]

     0x00000001 (NEEDED)                     Shared library: [liblog.so]

     0x00000001 (NEEDED)                     Shared library: [libicuuc.so]

     0x00000001 (NEEDED)                     Shared library: [libcamera_client.so]

     0x00000001 (NEEDED)                     Shared library: [libsurfaceflinger_client.so]

     0x00000001 (NEEDED)                     Shared library: [libdl.so]

     0x00000001 (NEEDED)                     Shared library: [libc.so]

     0x00000001 (NEEDED)                     Shared library: [libstdc++.so]

     0x00000001 (NEEDED)                     Shared library: [libm.so]

     0x0000000e (SONAME)                     Library soname: [libopencore_common.so]

     0x00000010 (SYMBOLIC)                   0x0

     0x00000019 (INIT_ARRAY)                 0xc7000

     0x0000001b (INIT_ARRAYSZ)               16 (bytes)

     0x00000004 (HASH)                       0xb4

     0x00000005 (STRTAB)                     0xc6fc

     0x00000006 (SYMTAB)                     0x420c

     0x0000000a (STRSZ)                      86133 (bytes)

     0x0000000b (SYMENT)                     16 (bytes)

     0x00000003 (PLTGOT)                     0xcc588

     0x00000002 (PLTRELSZ)                   1032 (bytes)

     0x00000014 (PLTREL)                     REL

     0x00000017 (JMPREL)                     0x22144

     0x00000011 (REL)                        0x21774

     0x00000012 (RELSZ)                      2512 (bytes)

     0x00000013 (RELENT)                     8 (bytes)

     0x6ffffffa (RELCOUNT)                   4012

     0x00000000 (NULL)

  • 相关阅读:
    HttpModule,HttpHandler,HttpHandlerFactory
    IHttpModule实现URL重写
    HttpModule与HttpHandler详解
    IHttpModule接口
    VS中新建网站和新建项目web应用程序的区别?(实际应用总结一点)
    slf4j简介
    SQL条件表达式
    Windows命令查看文件MD5
    Final对象
    Seasar2框架:AOP
  • 原文地址:https://www.cnblogs.com/mokliu/p/4073367.html
Copyright © 2011-2022 走看看