当前位置: 首页 > 知识库问答 >
问题:

尽管设置了 r 路径,但找不到一个 dll

骆文华
2023-03-14

ldd找不到rpath定义中存在的dll。找到了其他一些库(check/./../lib/*)

这里是 ldd 的输出(我们可以看到在 ../lib,但不是自由

root@hyperstream:/DT/local/ADE-trunk4/build-ADE-Desktop-Default/bin#ldd./ade_adminlinux-vdso.so.1=

root@hyperstream:/DT/local/ADE-trunk4/build-ADE-Desktop-Default/bin#file…/lib/libexpat.so.0…/lib/libexpat.so.0:ELF 64位LSB共享对象,x86-64,版本1(SYSV),动态链接,BuildID[sha1]=762de704943d03033d01a9725216d6b05d0740f5,未剥离

这里是rpath:

root @ hyperstream:/DT/local/ADE-trunk 4/build-ADE-Desktop-Default/bin # readelf-d ADE _ admin | grep ' r . * PATH ' 16:0x 00000000000001d(RUNPATH)库运行路径:[${ORIGIN}/../lib]

现在致命的事实是:它与clang 3.8一起工作,但与gcc 6.3一起失败(ubuntu 16.10)

显然,添加一个LD_LIBRARY_PATH=../lib 使它再次工作,但 rpath 的目标是避免设置它

root @ hyperstream:/DT/local/ADE-trunk 4/build-ADE-Desktop-Default/bin # export LD _ LIBRARY _ PATH =../lib root @ hyperstream:/DT/local/ADE-trunk 4/build-ADE-Desktop-Default/bin # ldd。/ade_admin linux-vdso.so.1 =

有什么想法吗?

当做

【人名】劳伦

共有1个答案

何浩荡
2023-03-14

我只是找到了一个解释:clang放在了elf二进制ALL库的[NEEDED]部分(即使是我自己没有明确包含的库,但被我包含的库的[NEEDED]部分引用)

来自gcc的示例:

readelf -d my_prog

Dynamic section at offset 0x9cb548 contains 46 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libadeversion.so]
 0x0000000000000001 (NEEDED)             Shared library: [libuuid.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libsqlite3.so]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libaprutil-1.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libapr-1.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libavahi-client.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libavahi-common.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libaio.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [lib_adm64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_dict64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_rdm64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_dbr64.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [${ORIGIN}/../lib/:$ORIGIN/../lib/:../lib/]

从叮当声:

readelf -d my_prog

Dynamic section at offset 0xa7bae8 contains 54 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libadeversion.so]
 0x0000000000000001 (NEEDED)             Shared library: [libuuid.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libsqlite3.so]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libaprutil-1.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libexpat.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libapr-1.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libavahi-client.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libavahi-common.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libaio.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [lib_adm64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_dict64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_rdm64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_rpc64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_sql64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_rdbc64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_rm64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_ncp64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_cmp64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_repfltr64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_expat64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_cncp64.so]
 0x0000000000000001 (NEEDED)             Shared library: [lib_dbr64.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [${ORIGIN}/../lib/:$ORIGIN/../lib/:../lib/]

一个dll包含缺少的一个libexpat:

readelf -d ../lib/libaprutil-1.so.0 

Dynamic section at offset 0x1e698 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: **[libexpat.so.0]**
 0x0000000000000001 (NEEDED)             Shared library: [libapr-1.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libuuid.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libcrypt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libaprutil-1.so.0]

但是RUNPATH只由二进制文件使用,而不是由dll使用(dll也可以有自己的RUNPATH)。

2个解决方案:-在libaprutil-1.so.0中添加一个运行路径,以强制包含来自“.”的库-在我的构建中显式添加所有缺失的dll

希望有帮助

 类似资料:
  • 问题内容: 我正在尝试将IBM的CPLEX库与我的Java应用程序集成。现在,我只是试图创建一个IloCplex对象。我添加了Cplex.jar,它可以很好地编译,但是当我运行它时: Cplex在抛出异常之前打印此消息: 我通过这个参数给JVM: 。这是cplex124.dll的位置。我看过的每个教程都给出了相同的步骤,我觉得自己很好地遵循了它们。 我究竟做错了什么?? 问题答案: 我在互连网上发

  • 我在WebStorm IDE中将SystemJs.d.ts文件添加到我的项目中。该文件包括类Promise的两种用法,TSC将其标记为错误。这是非常奇怪的,因为我已经将es6-promise.d.ts文件添加到我的项目中,它确实解决了mongodb.d.ts文件的相同问题。那么为什么在一个文件中它被识别,而在另一个文件中它不被识别呢?所有的.d.ts文件都位于同一个文件夹中(root-folder

  • 我试图将zip文件导出到一个目录,但遇到一个IOException,指出找不到文件路径。我知道这意味着父目录通常不存在,但是调试文件写入文件的行。getParentFile()。exists()返回true,因此这不是我的问题。更复杂的是,这种情况只发生在大约一半的文件中。通过java解压失败的文件总是相同的,但通过windows解压总是成功的。 以下是我正在使用的代码: 例外情况示例: 有关系统

  • 我还没有反应过来,所以我为这个问题的无知道歉。 我刚刚创建了一个新的React应用程序,我一直在使用文件夹结构。以下是我当前的文件夹结构: 在/react-app/src/components/app/app.js中,我需要导入logo.svg,它位于/react-app/src/assets/images/logo/logo.svg中。 在App.js中,我有以下行来导入徽标: 我得到以下错误:

  • 问题内容: 好吧,我很困惑。我的SQL Server JAR在这里: 我的类路径已设置: 它是JDBC 4.0驱动程序,因此我不需要这样做,但是我尝试设置类名。 我仍然执行我的程序,但出现错误: 万一有问题,我正在运行Windows 8.1。我已经尝试过以管理员身份或不以管理员身份使用命令提示符。 Java信息: 有任何想法吗? SQL Server是SQL Server Express 2012

  • 当我跑步时 $ionic cordova构建android 构建失败,出现此错误: Cordova build android找不到ANDROID_HOME环境变量。尝试设置它 尽管当我跑步时: 科尔多瓦要求 我得到以下结果: android的需求检查结果: Java JDK:已安装1.8.0 Android SDK:安装正确 Android目标:安装android-29、android-28、a