Undefined symbol when migrating to Postgres 11 [closed]
-
14-01-2021 - |
Pregunta
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:
Solución 2
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.
Otros consejos
# 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.