error while loading shared libraries: libgdal.so.1 in archlinux

Til Hund picture Til Hund · Sep 27, 2015 · Viewed 10.2k times · Source

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

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

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

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

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

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

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/

But /sbin/ldconfig -p | grep gdal still shows:

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

Answer

ahmed picture ahmed · Sep 27, 2015

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

after that, run /sbin/ldconfig