libgdal.so.20:未定义的符号:_ZN11xercesc_3_111InputSource11setEncodingEPKt

时间:2017-12-10 13:01:38

标签: matlab gdal opensuse

我正在尝试在OpenSuse 42.1的MATLAB 2017a环境下使用GMT(通用地图工具)版本5.2.1。

kleanthis@leonidas:~> which gmt
/usr/bin/gmt
kleanthis@leonidas:~> gmt

GMT - The Generic Mapping Tools, Version 5.2.1 (r15220) [64-bit] [MP] [8 cores] (c) 1991-2015 Paul Wessel, Walter H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe

Supported in part by the US National Science Foundation (http://www.nsf.gov/)
and volunteers from around the world (see http://gmt.soest.hawaii.edu/).

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program under the terms of the
GNU Lesser General Public License 
(http://www.gnu.org/licenses/lgpl.html).
For more information about legal matters, see the file named LICENSE.TXT.

usage: gmt [options]
   gmt <module name> [<module-options>]

options:
  --help            List a description of available GMT modules.
  --show-bindir     Show directory with GMT executables.
  --show-cores      Show number of available cores.
  --show-datadir    Show directory/ies with user data.
  --show-modules    Single list of all module names.
  --show-plugindir  Show directory for plug-ins.
  --show-sharedir   Show directory for shared GMT resources.
  --version         Print GMT version number.

if <module-options> is '=' we call exit (0) if module exist and non-zero 
otherwise.

如您所见,gmt(命令)正在终端中运行。 在matlab环境中,我对gdal库有以下问题。有任何建议如何解决这个问题?

>> !ls %command ls working fine
esa_snap_installers  giant  pyaps  TRAIN_3.beta_20171112  wraptext.m
>> !gmt 
gmt: symbol lookup error: /usr/lib64/libgdal.so.20: undefined symbol:_ZN11xercesc_3_111InputSource11setEncodingEPKt

我检查了PATH是否与终端和matlab具有相同的值,我得到了相同的结果。

kleanthis@leonidas:~> echo $PATH 
/usr/lib64:/usr/local/StaMPS_v3.3b1/bin:/usr/local/GMT5SAR//bin:
/usr/lib64:/usr/local/StaMPS_v3.3b1/bin:/usr/local/GMT5SAR//bin:
/usr/lib64/mpi/gcc/openmpi/bin:/home/kleanthis/bin:/usr/local/bin:
/usr/bin:/bin:/usr/bin/X11:/usr/games:
/opt/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin

>> system('echo $PATH')
/usr/lib64:/usr/local/StaMPS_v3.3b1/bin:/usr/local/GMT5SAR//bin
:/usr/lib64:/usr/local/StaMPS_v3.3b1/bin:/usr/local/GMT5SAR//bin:
/usr/lib64/mpi/gcc/openmp/bin:/home/kleanthis/bin:/usr/local/bin
:/usr/bin:/bin :/usr/bin/X11:/usr/games 
:/opt/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin

matlab中的LD_LIBRARY_PATH变量有一些额外的目录,但在这些目录中没有gdal的库。

kleanthis@leonidas:~> echo $LD_LIBRARY_PATH
/usr/lib64/:/usr/lib64/:/usr/lib64/mpi/gcc/openmpi/lib64

>> system('echo $LD_LIBRARY_PATH')
 /usr/local/MATLAB/R2017a/sys/opengl/lib/glnxa64:/usr/local/MATLAB/R2017a/sys/os/glnxa64:/usr/local/MATLAB/R2017a/bin/glnxa64:/usr/local/MATLAB/R2017a/extern/lib/glnxa64:/usr/local/MATLAB/R2017a/runtime/glnxa64:/usr/local/MATLAB/R2017a/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/R2017a/sys/java/jre/glnxa64/jre/lib/amd64/server
:/usr/lib64

ERROR 消息为:

gmt: symbol lookup error: /usr/lib64/libgdal.so.20: undefined 
symbol:_ZN11xercesc_3_111InputSource11setEncodingEPKt

有关错误的更多信息:

kleanthis@leonidas:~> cd /usr/lib64
kleanthis@leonidas:/usr/lib64> ls libgdal*
libgdal.so  libgdal.so.1  libgdal.so.1.18.3  libgdal.so.20 
 libgdal.so.20.3.2
kleanthis@leonidas:/usr/lib64> stat libgdal.so.20
  File: ‘libgdal.so.20’ -> ‘libgdal.so.20.3.2’
  Size: 17          Blocks: 0          IO Block: 4096   symbolic link
Device: 806h/2054d  Inode: 45503108    Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2017-12-10 14:43:35.055459036 +0200
Modify: 2017-12-10 14:43:31.251459025 +0200
Change: 2017-12-10 14:43:31.367459026 +0200
 Birth: -
kleanthis@leonidas:/usr/lib64> stat libgdal.so.20.3.2 
  File: ‘libgdal.so.20.3.2’
  Size: 19804496    Blocks: 38688      IO Block: 4096   regular file
Device: 806h/2054d  Inode: 45500543    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2017-12-10 14:43:35.055459036 +0200
Modify: 2017-12-05 01:32:17.000000000 +0200
Change: 2017-12-10 14:43:31.751459027 +0200
 Birth: -

为了列出libgdal.so.3.2

的依赖关系
kleanthis@leonidas:/usr/lib64> ldd libgdal.so.20.3.2 
    ldd: warning: you do not have execution permission for `./libgdal.so.20.3.2'
    linux-vdso.so.1 (0x00007ffc0358f000)
    libpoppler.so.44 => /usr/lib64/libpoppler.so.44 (0x00007ff6df5c5000)
    libfreexl.so.1 => /usr/lib64/libfreexl.so.1 (0x00007ff6df3b5000)
    libgeos_c.so.1 => /usr/lib64/libgeos_c.so.1 (0x00007ff6df18d000)
    libwebp.so.5 => /usr/lib64/libwebp.so.5 (0x00007ff6def2d000)
    libodbc.so.2 => /usr/lib64/libodbc.so.2 (0x00007ff6decc5000)
    libodbcinst.so.2 => /usr/lib64/libodbcinst.so.2 (0x00007ff6deaad000)
    libexpat.so.1 => /usr/lib64/libexpat.so.1 (0x00007ff6de87d000)
    libxerces-c-3.1.so => /usr/lib64/libxerces-c-3.1.so (0x00007ff6de2bd000)
    libopenjp2.so.7 => /usr/lib64/libopenjp2.so.7 (0x00007ff6de065000)
    libnetcdf.so.11 => /usr/lib64/libnetcdf.so.11 (0x00007ff6dacc5000)
    libhdf5.so.10 => /usr/lib64/libhdf5.so.10 (0x00007ff6da6e5000)
    libgif.so.6 => /usr/lib64/libgif.so.6 (0x00007ff6da4d5000)
    libjpeg.so.8 => /usr/lib64/libjpeg.so.8 (0x00007ff6da27d000)
    libgeotiff.so.2 => /usr/lib64/libgeotiff.so.2 (0x00007ff6da045000)
    libtiff.so.5 => /usr/lib64/libtiff.so.5 (0x00007ff6d9dcd000)
    libpng16.so.16 => /usr/lib64/libpng16.so.16 (0x00007ff6d9b8d000)
    libpq.so.5 => /usr/lib64/libpq.so.5 (0x00007ff6d995d000)
    libspatialite.so.7 => /usr/lib64/libspatialite.so.7 (0x00007ff6d91e5000)
    libsqlite3.so.0 => /usr/lib64/libsqlite3.so.0 (0x00007ff6d8f1d000)
    libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007ff6d8cad000)
    libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00007ff6d8a35000)
    libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007ff6d86c5000)
    libmysqlclient.so.18 => /usr/lib64/libmysqlclient.so.18 (0x00007ff6d8165000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff6d7ee5000)
    libz.so.1 => /lib64/libz.so.1 (0x00007ff6d7ccd000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007ff6d7ac5000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007ff6d773d000)
    libm.so.6 => /lib64/libm.so.6 (0x00007ff6d7435000)
    libc.so.6 => /lib64/libc.so.6 (0x00007ff6d708d000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ff6d6e75000)
    liblcms2.so.2 => /usr/lib64/liblcms2.so.2 (0x00007ff6d6c15000)
    libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00007ff6d69d5000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00007ff6d673d000)
    libgeos-3.4.2.so => /usr/lib64/libgeos-3.4.2.so (0x00007ff6d6395000)
    libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00007ff6d6185000)
    libmfhdf.so.4.2.11 => /usr/lib64/libmfhdf.so.4.2.11 (0x00007ff6d5f55000)
    libhdf5_hl.so.10 => /usr/lib64/libhdf5_hl.so.10 (0x00007ff6d5d2d000)
    libproj.so.12 => /usr/lib64/libproj.so.12 (0x00007ff6d5abd000)
    liblzma.so.5 => /usr/lib64/liblzma.so.5 (0x00007ff6d5895000)
    libjbig.so.2 => /usr/lib64/libjbig.so.2 (0x00007ff6d5685000)
    libssl.so.1.0.0 => /lib64/libssl.so.1.0.0 (0x00007ff6d541d000)
    libcrypto.so.1.0.0 => /lib64/libcrypto.so.1.0.0 (0x00007ff6d5025000)
    libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00007ff6d4ddd000)
    libldap_r-2.4.so.2 => /usr/lib64/libldap_r-2.4.so.2 (0x00007ff6d4b85000)
    libidn.so.11 => /usr/lib64/libidn.so.11 (0x00007ff6d494d000)
    libssh2.so.1 => /usr/lib64/libssh2.so.1 (0x00007ff6d471d000)
    liblber-2.4.so.2 => /usr/lib64/liblber-2.4.so.2 (0x00007ff6d450d000)
    libldap-2.4.so.2 => /usr/lib64/libldap-2.4.so.2 (0x00007ff6d42bd000)
    /lib64/ld-linux-x86-64.so.2 (0x0000559694a06000)
    libbz2.so.1 => /usr/lib64/libbz2.so.1 (0x00007ff6d40ad000)
    libhdf.so.4.2.11 => /usr/lib64/libhdf.so.4.2.11 (0x00007ff6d3df5000)
    libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00007ff6d3b1d000)
    libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00007ff6d38ed000)
    libcom_err.so.2 => /usr/lib64/libcom_err.so.2 (0x00007ff6d36e5000)
    libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x00007ff6d34d5000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x00007ff6d32bd000)
    libsasl2.so.3 => /usr/lib64/libsasl2.so.3 (0x00007ff6d309d000)
    libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007ff6d2e95000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007ff6d2c6d000)

已安装libxerces

kleanthis@leonidas:/usr/lib64> stat libxerces-c-3.1.so 
  File: ‘libxerces-c-3.1.so’
  Size: 3908336     Blocks: 7640       IO Block: 4096   regular file
Device: 806h/2054d  Inode: 45494387    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2017-12-12 22:12:18.144185210 +0200
Modify: 2016-08-25 15:17:03.000000000 +0300
Change: 2016-09-06 16:36:03.857567744 +0300
 Birth: -

非常感谢任何建议, 克莱安西斯

2 个答案:

答案 0 :(得分:0)

GMT和Matlab的共享库存在问题 这可能会有所帮助 - &gt; LINK

上述错误告诉我们,链接到gdal的xerces库与MATLAB加载的xerces库之间存在冲突。 看看这个link如何在Linux中安装GMT

答案 1 :(得分:0)

很遗憾,根据您建议的link,我无法解决此冲突。但是,我将我的GMT版本从5.2.1改为4.5.12,直到现在一切似乎都很好。希望这会为其他人节省一些时间。