1

After upgrading Postgres 10 to version 11, by using pg_upgrade, I get this error:

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

I'm using CentOS 7 and Postgis 2.4.

I've tried to investigate a little.

# nm -D /usr/pgsql-11/lib/postgis-2.4.so |grep geod_polygon_init
  U geod_polygon_init

The function is exported by the shared library! Why am I getting this error?

# ld -v /usr/pgsql-11/lib/postgis-2.4.so
GNU ld version 2.27-28.base.el7_5.1
ld: warning: cannot find entry symbol _start; not setting start address
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `repalloc'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `hash_create'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `get_guc_variables'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `init_MultiFuncCall'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `SPI_exec'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `WinGetFuncArgInPartition'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `SPI_gettype'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `geod_polygon_addpoint'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `get_fn_expr_argtype'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `GetDatabaseEncoding'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `SPI_execute'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `CurrentMemoryContext'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `SPI_getvalue'
...

Related questions:

  • Why aren't you running PostGIS 2.5? – Colin 't Hart Nov 7 '18 at 12:46
1
# ld -v /usr/pgsql-11/lib/postgis-2.4.so
GNU ld version 2.27-28.base.el7_5.1
ld: warning: cannot find entry symbol _start; not setting start address
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `repalloc'
/usr/pgsql-11/lib/postgis-2.4.so: undefined reference to `hash_create'

That's not actually a problem. You can't use ld like that, I think you want to use ldd there. It's a shared object, not a executable. Without a _start (or an entry point with -e) you can't call ld and produce an executable

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

That error is because I believe you're linking against a version of Proj4 that is too old. That's a distro problem if anything.

| improve this answer | |
  • ld tells me that geod_polygon_init is included in the .so. This is what it interests me most. Thanks for your suggestion. – david.perez Nov 7 '18 at 9:41
  • @david.perez where does it do that, that's not anywhere in the question. – Evan Carroll Nov 7 '18 at 10:27
  • That;s true, I've clipped the output of the ld command because it was too long. nm command also shows it is exported. But the important point is that it works if I compile it myself. – david.perez Nov 8 '18 at 8:13
0

I've downloaded Postgis source code 2.4.5 and compiled it myself and now it works ok.

My postgis-2.4.so is much bigger than the provided by yum, 2.4 Mb vs 750 Mb. The same can be said from other generated libraries.

| improve this answer | |

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