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?


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:

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
  • It looks like there's perhaps a tighter dependency in what SFCGAL version PostGIS 2.2 desires than the packager know about. If so, they could have packaged PostGIS against a newer version of SFCGAL than you have installed. I have queried the list on this. If you want to hand-fix it, you can delete your packages, and install the latest SFCGAL from source. – Paul Ramsey Aug 3 '16 at 13:29
  • Since I have all the GIS software installed from the UbuntuGIS PPA, compiling libraries from source will certainly lead to bigger problems down the road. Thanks for querying the list in any case. – Luís de Sousa Aug 3 '16 at 15:16
  • Maybe see if you can find a 1.3 SFCGAL package, perhaps from the repo you got postgresql from? – Paul Ramsey Aug 3 '16 at 16:04

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
  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

You don't need the libopenscenegraph-dev package for libsfcgal1, the libopenscenegraph100v5 & libopenthreads20 packages (from the UbuntuGIS PPA) are sufficient.

-dev packages are only required to build software that links to those libraries.

The OpenSceneGraph packages in the UbuntuGIS PPA have been rebuilt with the newer GDAL packages in the PPA. That's why you need those instead of the ones from the main xenial repository.

  • I always had libopenscenegraph100v5 installed. However, it might be possible that when I installed libopenscenegraph-dev it triggered an upgrade to libopenscenegraph100v5. The question then is why wasn't that upgrade triggered when I installed postgres and postgis. – Luís de Sousa Aug 8 '16 at 12:51
$ echo _ZN5osgDB13writeNodeFileERKN3osg4NodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKNS_7OptionsE |c++filt
osgDB::writeNodeFile(osg::Node const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, osgDB::Options const*)

Apparently you are missing an openscenegraph symbol.

Could you please provide the result of:

ldd /usr/lib/x86_64-linux-gnu/libSFCGAL.so

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.