加载共享库时出错:archlinux 中的 libgdal.so.1

加载共享库时出错:archlinux 中的 libgdal.so.1

问题描述:

我(我自己是一个程序新手)在archlinux中启动一个脚本时收到如下错误信息,这是朋友写的:

I (myself a programm novice) get the following error message when starting a script in archlinux, which has been written by a friend:

/usr/bin/psxy: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory
/usr/bin/psbasemap: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory
/usr/bin/ps2raster: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory
/usr/bin/psxy: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory

此时脚本中使用了通用映射工具 (GMT).我认为问题是链接器问题并且与 gdal 相关.安装的版本是:

At that point in the script it uses the Generic Mapping Tools (GMT). I think the problem is a linker problem and related to gdal. The version installed is:

gdalinfo --version
GDAL 2.0.0, released 2015/06/14

而且,确实,libgdal.so.1 没有安装(或已重命名为 /usr/lib/libgdal.so?):

And, indeed, libgdal.so.1 is not installed (or has been renamed to /usr/lib/libgdal.so?):

/sbin/ldconfig -p | grep gdal
    libgdal.so.20 (libc6,x86-64) => /usr/lib/libgdal.so.20
    libgdal.so (libc6,x86-64) => /usr/lib/libgdal.so

但是当我想安装gdal1时,它会与已经安装的gdal(我假设是2.0)发生冲突.

But when I want to install gdal1, then it comes to a conflict with the already installed gdal (which I presume is 2.0).

我能做什么?我是否必须编辑脚本,如果需要,在哪里使用 gdal?

What can I do? Do I have to edit the script and if so, where, to make it use of gdal?

在执行脚本之前,我输入 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib 并显示与上述相同的错误消息.

I enter LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib before executing the script with the same error message as above.

然后,我尝试通过 locate libgdal 来编辑 ldconfig 文件:

I have, then, tried to edit the ldconfig file by locate libgdal:

/usr/lib/libgdal.so
/usr/lib/libgdal.so.20
/usr/lib/libgdal.so.20.0.0

nano /etc/ld.so.conf -> adding /usr/lib/

但是/sbin/ldconfig -p |grep gdal 仍然显示:

libgdal.so.20 (libc6,x86-64) => /usr/lib/libgdal.so.20
libgdal.so (libc6,x86-64) => /usr/lib/libgdal.so

您可以创建指向该库的符号链接,以便您的应用程序可以找到它:

You can make a symbolic links to that library so your application can find it:

ln -s /usr/lib/libgdal.so /usr/lib/libgdal.so.1

之后,运行/sbin/ldconfig