ldd 未找到 xerces 的共享对象 (.so)

ldd not finding shared object (.so) for xerces

我正在尝试 运行 Xalan C++ 库提供的示例可执行文件,它需要 Xerces C 库。但是我无法正确 link 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

我什至添加了软 link 以确保包含 .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 不起作用。有谁知道我做错了什么?

这会产生什么:

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

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

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