【问题标题】:ldd not finding shared object (.so) for xercesldd 没有为 xerces 找到共享对象 (.so)
【发布时间】:2015-10-21 17:36:55
【问题描述】:

我正在尝试运行 Xalan C++ 库提供的示例可执行文件,它需要 Xerces C 库。但我无法正确链接 Xerces 共享对象文件。

mike@ubuntu:~/Xalan-C_1_9_0-redhat_80-gcc_32/bin$ ldd SimpleXPathAPI 
    linux-gate.so.1 =>  (0xf7765000)
    libxalan-c.so.19 => /home/mike/Xalan-C_1_9_0-redhat_80-gcc_32/lib/libxalan-c.so.19 (0xf7409000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf73ab000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf738e000)
    libxerces-c.so.26 => not found
    libxalanMsg.so.19 => /home/mike/Xalan-C_1_9_0-redhat_80-gcc_32/lib/libxalanMsg.so.19 (0xf7386000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf71d8000)
    /lib/ld-linux.so.2 (0xf7768000)
    libstdc++.so.5 => not found
    libxerces-c.so.26 => not found

我在LD_LIBRARY_PATH 中包含了包含libxerces-c.so 的位置,但ldd 找不到它。

mike@ubuntu:~/Xalan-C_1_9_0-redhat_80-gcc_32/bin$ echo $LD_LIBRARY_PATH
    /home/mike/Xalan-C_1_9_0-redhat_80-gcc_32/lib:/usr/local/lib

我什至添加了一个软链接以确保包含.26

mike@ubuntu:/usr/local/lib$ ls -l
total 98308
-rwxr-xr-x 1 root root  25560971 Aug 28 13:39 libxerces-c-3.1.so
-rw-r--r-- 1 root root  75080734 Aug 28 13:39 libxerces-c.a
-rwxr-xr-x 1 root root       962 Aug 28 13:39 libxerces-c.la
lrwxrwxrwx 1 root root        18 Aug 28 13:39 libxerces-c.so -> libxerces-c-3.1.so
lrwxrwxrwx 1 root root        14 Oct 21 10:31 libxerces-c.so.26 -> libxerces-c.so
drwxr-xr-x 2 root root      4096 Aug 28 13:39 pkgconfig
drwxrwsr-x 4 root staff     4096 Feb 18  2015 python2.7
drwxrwsr-x 3 root staff     4096 Feb 18  2015 python3.4
drwxr-xr-x 3 root root      4096 Jul  6 15:42 site_ruby

我第一次遇到libxalan-c.so.19=> not found 问题时,我通过将该文件的位置添加到我的LD_LIBRARY_PATH 来解决它。所以我不明白为什么相同的修复程序不适用于libxerces-c.so.26。有谁知道我做错了什么?

【问题讨论】:

  • 您的 Xalan 库的构建方式可能是它的依赖库位置被硬编码到其中。我相信常见的系统库可能会发生这种情况。您的 Xalan 库是如何以及在哪台机器上构建的?
  • @AnonMail 不幸的是,它们都是来自 Xalan 和 Xerces 网站的预编译二进制文件。这是否意味着我注定要失败?
  • 我错过了您所说的链接有问题的部分。你能显示你的链接命令和错误吗?可能是您的链接器找不到该库。在这种情况下,使用 -L 选项告诉它它在哪里。我相信 LD_LIBRARY_PATH 只适用于运行程序 - GNU 编译器不使用它来查找库位置。
  • @AnonMail 我想我在说链接时写错了。我的意思实际上是在运行二进制文件时出现问题,而不是在编译时尝试链接库。

标签: c++ shared-libraries xerces xalan ldd


【解决方案1】:

这会产生什么:

cd /usr/local/lib
file -L ./libxerces-c.so.26

很有可能,这将打印类似ELF 64-bit LSB shared object ... 的内容,在这种情况下,您试图将 32 位可执行文件指向 64 位库,而 不起作用。

您需要下载 libxerces 的 32 位版本。

【讨论】:

  • 你说得对,上面写着./libxerces-c.so.26: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=802588c1d05e6bcb968d63fe050422d780f3612d, not stripped
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多