永发信息网

Android下怎么使用LDD查看依赖库

答案:1  悬赏:50  手机版
解决时间 2021-04-10 17:32
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) 0x0

  转载
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
钳记茶业地址有知道的么?有点事想过去
广州到三亚多长时间,海口到三亚多少公里?坐
有电话号码可以查到居住地址吗?
右边漫画给我们的启示是A.合作是为对方工作减
广州自考本科一般需要多少钱
酒驾判刑是否有案底
我拿的卷闸摇控,另一职工要进来,我给开了,
赞美老鹰的句子
老婆跟人家跑了我们有结婚证,她抛弃了我和儿
腐乳扣肉怎么做
舍得茶馆总店怎么去啊,有知道地址的么
沼泽侧颈龟需要晒太阳吗
我开了一家水果店日语怎么说
When the little child caught sight of the
听音乐的时候耳朵里面咚咚响
推荐资讯
日语别怪我不讲道理
水乳,隔离霜谁先用怎么用???
关于我爱你的情话,最动人的情话,不是“我爱
致网友生日唯美的句子
Consult the page adapted from an English d
乐1Eui5.8(Android6.0)刷MIUI8(Android5.0)需
跪求300勇士帝国崛起!完整未删减版的!!在
苏打粉哪里买得到?
龙猫可以吃鸡蛋吗?
三国全面战争怎么刷钱
该失望伤心吗?
怎么成为明星啊?
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?