added new library, old one hanging around

In ubuntu 12.04, I downloaded the source for a geospatial library, gdal-1.11.0, into ~/src, configured it and compiled it successfully, it seemed. New files such as libgdal.a got put into /usr/local/lib.

However when I run a program that depends on it,

$ ogrinfo --formats

I get

ERROR 1: ogrinfo was compiled against GDAL 1.11 but current library version is 1.10

It seems I haven’t removed the older version of GDAL. How should I do that?

Some info about my system:

$ uname -a
Linux ubuntu 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Asked By: user1416227

||

The file libgdal.a will only be used when you link ogrinfo against it without the use of shared libraries. If ogrinfo was linked that way (not using shared libraries), you would not get the error, as the library (version 1.11) would be part of the executable.

What you should try is run

sudo ldconfig

after compiling and installing the new version of gdal, that should inform the system (in which version 1.10 is already loaded as shared library), that a new version is available.

Answered By: Anthon

It seems I haven’t removed the older version of GDAL. How should I do that?

Attempting make uninstall is a reasonable option, if you have kept the sources, which is good practice if you are doing local installs.

A simple alternative is to remove all files relating to this library, both old and new and then reinstall the new one.

However, I have to wonder why you are installing from source when the package is available on Debian, and therefore on Ubuntu. If you are on an older release/version of Ubuntu, and there are no suitable PPAs available, note that backporting from a newer release/version of Ubuntu is possible, and much of the time not difficult.

The listed build dependencies of GDAL 1.11 in Debian are

Build-Depends: debhelper (>= 9), dh-autoreconf, zlib1g-dev, libnetcdf-dev (>=
1:4.0.0), netcdf-bin, libjasper-dev, libpng-dev,
libjpeg-dev, libgif-dev, libwebp-dev, libhdf4-alt-dev [!ppc64],
libhdf5-dev (>= 1.8.8), libpcre3-dev, libpq-dev, libxerces-c-dev,
unixodbc-dev (>= 2.2.11), doxygen, d-shlibs, libgeos-dev,
libmysqlclient-dev, dh-python, python-all-dev (>= 2.6.6-3~),
python-numpy, python3-all-dev, python3-numpy, libcurl4-gnutls-dev |
libcurl-ssl-dev, libsqlite3-dev, libogdi3.2-dev, chrpath, swig, patch,
libexpat1-dev, libproj-dev, libdap-dev, libxml2-dev, libspatialite-dev
(>= 2.4.0~rc2-4), libepsilon-dev (>= 0.9.1-1~),
libpoppler-private-dev, liblzma-dev, libopenjpeg-dev,
libarmadillo-dev, libfreexl-dev (>= 1.0.0), libkml-dev (>= 1.3.0~),
liburiparser-dev, default-jdk, ant

which doesn’t look too bad. To be clear, the idea here is to rebuild Debian/Ubuntu sources on your release. If you want tips or more details, I can elaborate.

Here are the versions of GDAL available in Debian.

$ apt-cache policy libgdal1-dev
libgdal1-dev:
  Installed: (none)
  Candidate: 1.9.0-3.1
  Version table:
     1.11.0+dfsg1-1~exp2 0
          1 http://debian.lcs.mit.edu/debian/ experimental/main amd64 Packages
     1.10.1+dfsg-6 0
         50 http://debian.lcs.mit.edu/debian/ testing/main amd64 Packages
         50 http://debian.lcs.mit.edu/debian/ unstable/main amd64 Packages
     1.9.0-3.1 0
        500 http://debian.lcs.mit.edu/debian/ wheezy/main amd64 Packages
     1.6.3-4+b1 0
        500 http://debian.lcs.mit.edu/debian/ squeeze/main amd64 Packages
Answered By: Faheem Mitha
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.