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.
Best Answer
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 :
in case you want to test the build prior installing :
and then