[GIS] “libSFCGAL.so.1: undefined symbol” upgrading to Postgis 2.2.2 (and 2.2.1)

postgispostgis-2.2postgresql

I recently got PostGIS upgraded to version 2.2.2. I would like to upgrade a legacy database to this new version, running this query:

alter extension postgis update to "2.2.2"

The result is this error:

ERROR: could not load library "/usr/lib/postgresql/9.3/lib/postgis-2.2.so": /usr/lib/x86_64-linux-gnu/libSFCGAL.so.1: undefined symbol: _ZN5osgDB13writeNodeFileERKN3osg4NodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKNS_7OptionsE
    SQL state: 58P01

I have the SFCGAL library installed with headers and debug symbols:

$ dpkg -l | grep sfcgal
ii  libsfcgal-dev                                               1.2.2-1                                                     amd64        Library for ISO 19107:2013 and OGC SFA 1.2 for 3D operations (dev part)
ii  libsfcgal1                                                  1.2.2-1                                                     amd64        Library for ISO 19107:2013 and OGC SFA 1.2 for 3D operations (runtime part)
ii  sfcgal-bin                                                  1.2.2-1                                                     amd64        Simple viewer for SFCGAL library
ii  sfcgal-dbg                                                  1.2.2-1                                                     amd64        Debug symbols for SFCGAL

How can I overcome this?

Update

I was not able to find a package source for a more recent version of the SFCGAL library. Therefore I decided to re-install the software stack from a single repository, the UbuntuGIS PPA. Now I have the following set up:

  • postgresql-9.5
  • postgresql-9.5-postgis-2.2 (2.2.1+dfsg-3~xenial0)
  • postgis (2.2.1+dfsg-3~xenial0)
  • libsfcgal1 (1.2.2-1)

But with this new setup I get the same error:

# CREATE EXTENSION postgis;
ERROR:  could not load library "/usr/lib/postgresql/9.5/lib/postgis-2.2.so": /usr/lib/x86_64-linux-gnu/libSFCGAL.so.1: undefined symbol: _ZN5osgDB13writeNodeFileERKN3osg4NodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKNS_7OptionsE

Best Answer

Over at the UbuntuGIS mailling list a reference came up to OpenSceneGraph packages (also in the comment by vmora). As it turns out the headers package for this library was not installed:

$ aptitude search libopenscenegraph
p   libopenscenegraph-dev                                                      - 3D scene graph, development files                                                    
p   libopenscenegraph-dev:i386                                                 - 3D scene graph, development files                                                    
i   libopenscenegraph100v5                                                     - 3D scene graph, shared libs                                                          
p   libopenscenegraph100v5:i386                                                - 3D scene graph, shared libs                                                          
c   libopenscenegraph99                                                        - 3D scene graph, shared libs            

After installing the libopenscenegraph-dev package I can use PostGIS again. As suggested in the mailling list, the correct version of this package is also provided by the UbuntuGIS PPA:

$ apt policy libopenscenegraph-dev
libopenscenegraph-dev:
  Installed: 3.2.3+dfsg1-1~xenial0
  Candidate: 3.2.3+dfsg1-1~xenial0
  Version table:
 *** 3.2.3+dfsg1-1~xenial0 500
        500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
     3.2.1-7ubuntu4 500
        500 http://ch.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Related Question