Thread: BUG #15522: pg_upgrade from 9.6 to PG 11.1 with postgis 2.4.5 giveerror undefined symbol geod_polygon_init

The following bug has been logged on the website:

Bug reference:      15522
Logged by:          Peter Svensson
Email address:      peter.svensson@smhi.se
PostgreSQL version: 11.1
Operating system:   Rhel 7.5
Description:

pg_upgrade  give an error when trying to upgrade from  postgresql 9.6  to
postgresql 11 if there are databases with postgis.
I am using  postgresql RPM:s from
https://yum.postgresql.org/11/redhat/rhel-7-x86_64/

 /usr/pgsql-11/bin/pg_upgrade -d /var/lib/pgsql/9.6/data -D
/var/lib/pgsql/11/data -b /usr/pgsql-9.6/bin -B /usr/pgsql-11/bin --link -c
-v
Your installation references loadable libraries that are missing from the
new installation.  You can add these libraries to the new installation,
or remove the functions using them from the old installation.  A list of
problem libraries is in the file:
    loadable_libraries.txt

$ cat loadable_libraries.txt 
could not load library "$libdir/postgis-2.4": ERROR:  could not load library
"/usr/pgsql-11/lib/postgis-2.4.so": /usr/pgsql-11/lib/postgis-2.4.so:
undefined symbol: geod_polygon_init
could not load library "$libdir/rtpostgis-2.4": ERROR:  could not load
library "/usr/pgsql-11/lib/rtpostgis-2.4.so":
/usr/pgsql-11/lib/rtpostgis-2.4.so: undefined symbol: geod_polygon_init
could not load library "$libdir/postgis_topology-2.4": ERROR:  could not
load library "/usr/pgsql-11/lib/postgis_topology-2.4.so":
/usr/pgsql-11/lib/postgis_topology-2.4.so: undefined symbol:
geod_polygon_addpoint


Postgis RPM postgis24_11-2.4.5-1.rhel7.1.x86_64   has  dependency both to
proj 4.8 and proj 4.9,  but should probably only have deps to proj 4.9
 
yum deplist postgis24_11   |grep proj
  dependency: libproj.so.0()(64bit)
   provider: proj.x86_64 4.8.0-4.el7
  dependency: libproj.so.12()(64bit)
   provider: proj49.x86_64 4.9.3-3.rhel7.1
  dependency: proj49
   provider: proj49.x86_64 4.9.3-3.rhel7.1


Repeat:   Install postgres 9.6 and postgis 2.4.5  (postgis24_96)  from
postgresql repo   and create a database with postgis.    Then install
postgres 11 and dependent  postgis  (postgis24_11). Perform a pg_upgrade
with check.  


See also BUG #15472 which seem to have same postgis problem, but for postgis
2.5.0