0

After an unthoughtful apt-get update today, GDAL no longer works on my Ubuntu Machine (bionic) because libogdi.so.3.2 is missing:

daniel@gin-nuest:~$ gdalinfo 
gdalinfo: error while loading shared libraries: libogdi.so.3.2: cannot open shared object file: No such file or directory

The link actually seems be missing, and OGDI is installed in version 4.1

daniel@gin-nuest:~$ ldd /usr/bin/gdalinfo
[..]
    libgdal.so.20 => /usr/local/lib/libgdal.so.20 (0x00007fc157fc5000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc157bd4000)
[..]
    libogdi.so.3.2 => not found
    libgif.so.7 => /usr/lib/x86_64-linux-gnu/libgif.so.7 (0x00007fc1541cf000)
    libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007fc153f67000)
    libgeotiff.so.2 => /usr/lib/x86_64-linux-gnu/libgeotiff.so.2 (0x00007fc153d31000)
[..]

I have removed GDAL and reinstalled (from UbuntuGIS unstable), but it seems I only get OSGI 3.2 when uninstalling GDAL.

daniel@gin-nuest:~$ apt-cache search ogdi
libcgi-application-basic-plugin-bundle-perl - bundle of basic plugins for CGI::Application
libcgi-application-plugin-logdispatch-perl - plugin that adds Log::Dispatch support to CGI::Application
libogdi3.2 - Open Geographic Datastore Interface Library -- library
libogdi3.2-dev - Open Geographic Datastore Interface Library -- development
ogdi-bin - Open Geographic Datastore Interface Library -- utilities
libogdi-dev - Open Geographic Datastore Interface Library -- development
libogdi4.1 - Open Geographic Datastore Interface Library -- library
daniel@gin-nuest:~$ sudo apt-get install libogdi3.2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
[..]
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libproj12
Suggested packages:
  ogdi-bin
The following packages will be REMOVED
  gdal-bin libgdal-dev libgdal20 libogdi-dev libogdi4.1 ogdi-bin
The following NEW packages will be installed
  libogdi3.2 libproj12
0 to upgrade, 2 to newly install, 6 to remove and 0 not to upgrade.

I have GDAL 2.4.2, which should link to libogdi-dev:

daniel@gin-nuest:~$ sudo apt-get install libgdal-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgdal-dev is already the newest version (2.4.2+dfsg-1~bionic0).

daniel@gin-nuest:~$ apt-cache show libgdal-dev 
Package: libgdal-dev
Source: gdal
Priority: optional
Section: libdevel
Installed-Size: 43790
Maintainer: Debian GIS Project <pkg-grass-devel@lists.alioth.debian.org>
Architecture: amd64
Version: 2.4.2+dfsg-1~bionic0
Suggests: libgdal-doc
Depends: libgdal20 (= 2.4.2+dfsg-1~bionic0), libc6-dev, libarmadillo-dev, libcharls-dev, libcurl4-gnutls-dev | libcurl-ssl-dev, libdap-dev, libepsilon-dev, libexpat1-dev, libfreexl-dev, libfyba-dev, libgeos-dev, libgeotiff-dev, libgif-dev, libhdf4-alt-dev, libhdf5-dev, libjpeg-dev, libjson-c-dev, libkml-dev, libltdl-dev, liblzma-dev, default-libmysqlclient-dev, libnetcdf-dev, libogdi-dev, libopenjp2-7-dev, libpcre3-dev, libpng-dev, libpoppler-private-dev, libpq-dev, libproj-dev, libqhull-dev, libspatialite-dev, libsqlite3-dev, libtiff-dev, liburiparser-dev, libwebp-dev, libxerces-c-dev, libxml2-dev, libzstd-dev, unixodbc-dev
Filename: pool/main/g/gdal/libgdal-dev_2.4.2+dfsg-1~bionic0_amd64.deb
Size: 7493120
MD5sum: 28a4b604a9274a087dfbd274989a6a2f
SHA1: 38402e01ef5d1833afcc75c673efadacdca53c13
SHA256: 19f27da9c9fecd0d58d9eb1dda8bfa0f4d4af85ca4ea94241446f97e14b41aa1
Description-en_GB: Geospatial Data Abstraction Library - Development files
 GDAL is a translator library for raster geospatial data formats. As a
 library, it presents a single abstract data model to the calling
 application for all supported formats. The related OGR library (which
 lives within the GDAL source tree) provides a similar capability for
 simple features vector data.
 .
 GDAL supports many popular data formats, including commonly used ones
 (GeoTIFF, JPEG, PNG and more) as well as the ones used in GIS and remote
 sensing software packages (ERDAS Imagine, ESRI Arc/Info, ENVI, PCI
 Geomatics). Also supported many remote sensing and scientific data
 distribution formats such as HDF, EOS FAST, NOAA L1B, NetCDF, FITS.
 .
 OGR library supports popular vector formats like ESRI Shapefile, TIGER
 data, S57, MapInfo File, DGN, GML and more.
 .
 This package contains the files needed to develop a software that will use
 the GDAL/OGR (headers, static objects, configuration script).
Description-md5: fe1355584b1a93438b3699e1581cff4b

Package: libgdal-dev
Architecture: amd64
Version: 2.2.3+dfsg-2
Priority: extra
Section: universe/libdevel
Source: gdal
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian GIS Project <pkg-grass-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 38196
Depends: libgdal20 (= 2.2.3+dfsg-2), libc6-dev, libarmadillo-dev, libcurl4-gnutls-dev | libcurl-ssl-dev, libdap-dev, libepsilon-dev, libexpat1-dev, libfreexl-dev, libfyba-dev, libgeos-dev, libgeotiff-dev, libgif-dev, libhdf4-alt-dev, libhdf5-dev, libjpeg-dev, libjson-c-dev, libkml-dev, libltdl-dev, liblzma-dev, default-libmysqlclient-dev, libnetcdf-dev, libogdi3.2-dev, libopenjp2-7-dev, libpcre3-dev, libpng-dev, libpoppler-private-dev, libpq-dev, libproj-dev, libqhull-dev, libspatialite-dev, libsqlite3-dev, libtiff-dev, liburiparser-dev, libwebp-dev, libxerces-c-dev, libxml2-dev, unixodbc-dev
Suggests: libgdal-doc
Filename: pool/universe/g/gdal/libgdal-dev_2.2.3+dfsg-2_amd64.deb
Size: 6368740
MD5sum: 711832653250698db1fc098f873a8160
SHA1: 0aba22cd81a92495d129a8bdb5dcf6dab63888a7
SHA256: 82bf99ada413ec8f00b544cf7123d458e58fb994e5d84d93ec9407f7b5877c0f
Homepage: http://www.gdal.org/
Description-en_GB: Geospatial Data Abstraction Library - Development files
 GDAL is a translator library for raster geospatial data formats. As a
 library, it presents a single abstract data model to the calling
 application for all supported formats. The related OGR library (which
 lives within the GDAL source tree) provides a similar capability for
 simple features vector data.
 .
 GDAL supports many popular data formats, including commonly used ones
 (GeoTIFF, JPEG, PNG and more) as well as the ones used in GIS and remote
 sensing software packages (ERDAS Imagine, ESRI Arc/Info, ENVI, PCI
 Geomatics). Also supported many remote sensing and scientific data
 distribution formats such as HDF, EOS FAST, NOAA L1B, NetCDF, FITS.
 .
 OGR library supports popular vector formats like ESRI Shapefile, TIGER
 data, S57, MapInfo File, DGN, GML and more.
 .
 This package contains the files needed to develop a software that will use
 the GDAL/OGR (headers, static objects, configuration script).
Description-md5: fe1355584b1a93438b3699e1581cff4b
Supported: 3y

daniel@gin-nuest:~$ which gdalinfo
/usr/bin/gdalinfo
daniel@gin-nuest:~$ /usr/bin/gdalinfo 
/usr/bin/gdalinfo: error while loading shared libraries: libogdi.so.3.2: cannot open shared object file: No such file or directory

Further information:

daniel@gin-nuest:~$ apt-cache madison gdal
      gdal | 2.2.3+dfsg-2 | http://archive.ubuntu.com/ubuntu bionic/universe Sources
      gdal | 2.4.2+dfsg-1~bionic0 | http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu bionic/main Sources
      gdal | 2.2.2+dfsg-1~xenial1 | http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial/main Sources
daniel@gin-nuest:~$ apt-cache policy gdal
N: Unable to locate package gdal
daniel@gin-nuest:~$ apt-cache policy libgdal-dev
libgdal-dev:
  Installed: 2.4.2+dfsg-1~bionic0
  Candidate: 2.4.2+dfsg-1~bionic0
  Version table:
 *** 2.4.2+dfsg-1~bionic0 500
        500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status
     2.2.3+dfsg-2 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
aniel@gin-nuest:~$ apt-cache policy ogdi-bin 
ogdi-bin:
  Installed: 4.1.0+ds-1~bionic0
  Candidate: 4.1.0+ds-1~bionic0
  Version table:
 *** 4.1.0+ds-1~bionic0 500
        500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status
     3.2.0+ds-2 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

Summary

gdal-bin links to libogdi.so.3.2 it seems, but when I install it, it wants to install libogdi4.1:

daniel@gin-nuest:~$ sudo apt-get install gdal-bin 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libgdal20 libogdi4.1
Suggested packages:
  libgdal-grass python-gdal ogdi-bin
The following packages will be REMOVED
  libogdi3.2
The following NEW packages will be installed
  gdal-bin libgdal20 libogdi4.1
0 to upgrade, 3 to newly install, 1 to remove and 0 not to upgrade.

Not a solution

I can install the older GDAL from Ubuntu's sources:

sudo apt-get install libgdal20=2.2.3+dfsg-2
sudo apt-get install gdal-bin=2.2.3+dfsg-2
sudo apt-get install libgdal-dev=2.2.3+dfsg-2
sudo apt-get install gdal-data=2.2.3+dfsg-2
sudo apt-get install libproj-dev=4.9.3-2
[..]
daniel@gin-nuest:~$ gdalinfo  --version
GDAL 2.3.2, released 2018/09/21

Excursion

A futher problem downstream (installing the sf package in R) was then due to a stray libgdal.so file, probably from a two year old source install, which helped me to solve the the undefined symbol: _ZN10OGRFeature20GetFieldAsDoubleListEiPi problem on my machine:

I identified this by running

daniel@gin-nuest:/usr/share/proj$ ldconfig -p | grep gdal
    libgdal.so.20 (libc6,x86-64) => /usr/local/lib/libgdal.so.20
    libgdal.so.20 (libc6,x86-64) => /usr/lib/libgdal.so.20
    libgdal.so (libc6,x86-64) => /usr/local/lib/libgdal.so
    libgdal.so (libc6,x86-64) => /usr/lib/libgdal.so

So, two libgdal.so. After uninstalling GDAL (libgdal20) and then running the same command again I got:

daniel@gin-nuest:/usr/share/proj$ ldconfig -p | grep gdal
    libgdal.so.20 (libc6,x86-64) => /usr/local/lib/libgdal.so.20
    libgdal.so (libc6,x86-64) => /usr/local/lib/libgdal.so

So I manually removed the files (daniel@gin-nuest:/usr/local/lib$ sudo rm libgdal.*) and then installed GDAL from Ubuntu sources (not UbuntuGIS unstable). Installation of sf works again:

> library("sf")
Linking to GEOS 3.7.1, GDAL 2.2.3, PROJ 4.9.3

Solution

As pointed out below, the library in /usr/local/lib was a leftover from a manual compilation. Once that was cleared as stated above, I could

  • enable UbuntuGIS unstable
  • update GDAL and other libraries

and now have the latest versions installed.

closed as off-topic by Vince, nmtoken, xunilk, AndreJ, LaughU Jul 22 at 6:54

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "Questions that relate to the business of vendors and product teams, such as licensing, pricing, release dates, submission of bug reports and enhancement requests, etc, are off-topic here and should be directed instead to the official software support teams." – Vince, nmtoken, LaughU
  • "Questions relating to general IT or with no clear GIS component, are off-topic here but can be researched/asked at Stack Overflow (software development), Super User (computing hardware and software), Database Administrators (relational databases) and other SE sites" – xunilk, AndreJ
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Reports of instability of unstable releases really ought to be reported to those doing the releasing. – Vince Jul 20 at 14:58
  • Good point Vince, I will notice UbuntuGIS mailing list. – daniel Jul 20 at 16:44
0

After a clean install on my system, I can run gdalinfo without any problem.

It seems you have a version of libgdal20 in /usr/local/lib/ from some self-compilation of an older GDAL version. This overrides any installation by apt, and apt can not remove it.

You have to recompile that version from GDAL 2.4.2 sources to get rid of your error.

Nothing to blame the ubuntugis people for.

  • Apologies if you feel like I blamed anyone. I've reached out on the UbuntuGIS mailing list and they seemed fine with me reporting my observations. – daniel Jul 21 at 10:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.