Search code examples
c++shared-librariesxercesxalanldd

ldd not finding shared object (.so) for xerces


I am trying to run a sample executable provided with Xalan C++ library, which requires a the Xerces C library. But I am not able to properly link the Xerces shared object file.

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

I included the location containing the libxerces-c.so in my LD_LIBRARY_PATH but ldd will not find it.

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

I even added a soft link to ensure the .26 is included.

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

The first time I had this => not found issue with libxalan-c.so.19 I solved it by adding the location of that file to my LD_LIBRARY_PATH. So I can't figure out why the same fix is not working for the libxerces-c.so.26. Does anyone know what I'm doing wrong?


Solution

  • What does this produce:

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

    Chances are, this will print something like ELF 64-bit LSB shared object ..., in which case you are trying to point 32-bit executable at 64-bit libraries, and that doesn't work.

    You need to download a 32-bit build of libxerces.