0

I upgraded Ubuntu from 15.01 to 16.04 and PostGIS is broken. Below are the errors:

psql (9.5.2)
Type "help" for help.

osm=# select version();
version                                           
-------------------------------------------------------------------------------------------------
 PostgreSQL 9.5.2 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit
(1 row)

osm=# \dx
                                      List of installed extensions<br>
   Name    | Version |   Schema   |                             Description                             
-----------+---------+------------+---------------------------------------------------------------------
 hstore    | 1.3     | public     | data type for storing sets of (key, value) pairs
 pgrouting | 2.1.0   | public     | pgRouting Extension
 plpgsql   | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis   | 2.2.2   | public     | PostGIS geometry, geography, and raster spatial types and functions
(4 rows)

osm=# select postgis_full_version();
ERROR:  could not load library "/usr/lib/postgresql/9.5/lib/postgis-2.2.so": /usr/lib/postgresql/9.5/lib/postgis-2.2.so: undefined symbol: lwgeom_sfcgal_version
CONTEXT:  SQL statement "SELECT postgis_lib_version()"
PL/pgSQL function postgis_full_version() line 22 at SQL statement

This database had PostGIS working before the upgrade. I tried create extension postgis; on a new database and got the same error. I also tried to remove and install PostGIS again but to no avail.

  • The error suggests that you don't have lwgeom installed. Can you check if it is, and if not, try installing that (sudo apt-get install liblwgeom)? You may need to restart postgres afterwards. – BradHards May 7 '16 at 0:25
  • 1
    I rebuilt postgis-2.2.2 from source and the problem is resolved, so evidently the binary in Ubuntu Xenial repo is somehow broken. The build steps are all default: <pre> ./configure make sudo make install </pre> Before this, I tried to install liblwgeom-2.2.5 and liblwgeom-dev but they did not help (2.2.5 was already present). – Huanchun Ye May 7 '16 at 0:53
  • Perhaps you should post that as the answer. – BradHards May 7 '16 at 1:45
5

Rebuilding from source worked for me also.

The problem wasn't realy system upgrade. Simply, creating extensions such as postgis_topology or postgis_tiger_geocoder threw exactly the same error.

I advise also restarting postgresql service after rebuilding, just in case. Or better :
-stop the service; -rebuild; -start again the service;

And it might be worth adding sudo ldconfig at the end :

./configure
make

in case you want to test the build prior installing :

make test

and then

sudo make install
sudo ldconfig
  • ldconfig is good advice. – John Powell Jul 19 '16 at 16:25
2

Rebuilding postgis-2.2.2 from the source solved the problem, using the default build steps:

./configure
make
make install

0

This solved this issue for me (it says 14.04 but solved for 16.04):

PostGIS non functional on Ubuntu 14.04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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