5

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
3
  • 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. Commented Aug 3, 2016 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. Commented Aug 3, 2016 at 15:16
  • Maybe see if you can find a 1.3 SFCGAL package, perhaps from the repo you got postgresql from? Commented Aug 3, 2016 at 16:04

4 Answers 4

4
+100

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

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.

1
  • 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. Commented Aug 8, 2016 at 12:51
0

In case anybody faces below error

ERROR:  could not load library "/usr/pgsql-12/lib/postgis-3.so": /lib64/libSFCGAL.so.1: undefined symbol: _ZN5boost7archive18text_iarchive_implINS0_13text_iarchiveEE4loadERSs

Upgrading boost-serialization yum package can help.

thanks to @vmora 's answer, It gave me a hint and I was able to fix this issue by executing

yum install -y http://mirror.centos.org/centos/7/os/x86_64/Packages/boost-serialization-1.53.0-28.el7.x86_64.rpm

Hope it helps someone :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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