PostGIS extension undefined symbol: GEOSCoordSeq_getXY - postgresql

I am trying to create postgis 3.0 extension on postgresql12 on centos7 (both are installed using yum native rpms)
yum install postgis30_12.x86_64
but i am getting different errors with GEOS. currently the error i am getting is
postgres=# create extension postgis;
ERROR: could not load library
"/usr/pgsql-12/lib/postgis-3.so": /usr/pgsql-12/lib/postgis-3.so:
undefined symbol: GEOSCoordSeq_getXY
geos-config --version
3.8.0

i have resolved the issue by running ldd libgeos_c.so.1 to find which one is being used by postgresql12 and manually replaced it with the one that comes after installing geos38 and the create extension succeeded.

The PostGIS binary you are using was built with a GEOS version that is incompatible with the one installed. You have to either install a different GEOS library or a different PostGIS.
Normally, such an incompatibility should be made obvious by using a different library version. GEOS seems to be sloppy here.

Related

Installing pgrouting on macos

I am struggling getting the pgrouting extension to Postgresql to work. I am running PG 13 and attempting to install pgrouting 3.3.0. The hos OS is Mac Monterey 12.0.1 (M1).
I have built pgrouting from source and all seems to go well. I had though to copy the extension control file manually and the so file. When I try to install the extension in PB ('create extension pgrouting cascade') I get:
ERROR: could not load library "/Applications/Postgres.app/Contents/Versions/13/lib/postgresql/libpgrouting-3.3.so": dlopen(/Applications/Postgres.app/Contents/Versions/13/lib/postgresql/libpgrouting-3.3.so, 0x000A): tried: '/Applications/Postgres.app/Contents/Versions/13/lib/postgresql/libpgrouting-3.3.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/libpgrouting-3.3.so' (no such file)
SQL state: 58P01
Any clue to what is wrong?

ERROR: incompatible library while creating extension in Postgresql

I use Centos 7 and Postgresql 12. I installed already PostGIS and created successfully its extension. I'm now tring to install semver extension with create extension semver and get following error:
ERROR: incompatible library »/usr/pgsql-12/lib/semver.so«: version
does not match
According to developer this version should work with my Postgresql 12. Why am i getting this error?
Thanks!
An extension's .so binaries are specific to a major release of Postgres.
If you're installing the extension through yum, there would typically be a different package for each Postgres version. For example, if you installed Postgres 12 using the postgresql12-server package, then you would install PostGIS 3.0 using the postgis30_12 package.
If the package name is just pg-semver, without a Postgres version number, then it's probably intended for your distribution's default postgresql-server package. In CentOS 7, this appears to be Postgres 9.2, so these files won't work on a Postgres 12 server.
If you can't find a PG12-specific package, you'll need to build it yourself, using the instructions here.

Can not find PostGIS extensions ( installed in a different directory ) and $libdir/postgis-2.3 in mac os

I'm using postgres in pycharm and it can't find the postGIS extensions. It is looking for them in: /Library/PostgreSQL/9.6/share/postgresql/extension/
however, when I install PostGIS, it tells me that: PostGIS extension modules are installed in: /usr/local/share/postgresql/extension
Another issue (don't know if it is related to the first) is : could not access file "$libdir/postgis-2.3": No such file or directory
I noticed this issue after having upgraded from PostGIS 2.3.0 to 2.4.0. My databases were still looking for 2.3.0 libraries when the 2.4.0 were installed.
The solution was to individually update the databases to look for the 2.4.0 versions:
ALTER EXTENSION postgis UPDATE;
SELECT PostGIS_full_version();
See Upgrading PostGIS section for further details
I installed using Homebrew and ran into this same issue. Seems to be resolved after following instructions from https://www.linuxquestions.org/questions/fedora-35/problems-to-start-postgresql-with-postgis-after-upgrade-to-fedora-28-a-4175629479/#post5853352:
Find where postgis-2.4.so is (e.g.
/database/postgresql/pgsql-10.0/lib/postgis-2.4.so) then create a
symbolic link to older name so for my example I'd do:
ln -s /database/postgresql/pgsql-10.0/lib/postgis-2.4.so /database/postgresql/pgsql-10.0/lib/postgis-2.3.so
For me, the fix was this exact command:
ln -s /usr/local/lib/postgresql/postgis-2.5.so /usr/local/lib/postgresql/postgis-2.3.so

Can't use uuid and create an extension to use it

I want to use uuid in Postgresql 9.2 on Ubuntu 13. So when I tried to check whether is available or not, I did:
select uuid_generate_v4() as one;
And it gave me ERROR: function uuid_generate_v4() does not exist
Then I did CREATE EXTENSION "uuid-ossp";
ERROR: could not open extension control file "/usr/share/postgresql/9.2/extension/uuid-ossp.control": No such file or directory
Well, what do I do next?
By the way, SELECT * FROM pg_available_extensions; returns plpsql (1.0) only.
The operating system package that contains the extension is not installed. To install it:
apt-get install postgresql-contrib-9.2
For anyone using the asdf version manager with the asdf-postgres plugin, installing postgres versions as follows fixes this issue:
POSTGRES_EXTRA_CONFIGURE_OPTIONS=--with-uuid=e2fs asdf install postgres <VERSION>
For you guys, who installed postgres using postgres rpm repo on Fedora or similar distro:
sudo dnf install postgresql-contrib
installs a package from default fedora repo, which conflicts with postgres, like:
/usr/pgsql-12/lib/libpq.so.5: no version information available (required by psql)
Right way is
sudo dnf install postgresql12-contrib
You can double check it during install, it has to be from pgdg12, same as postgresql-server
(you have insert your postgres version instead of '12')
If you still get the error, try to run manually the two SQL files inside /usr/share/postgresql/9.X/extension/uuid-ossp*.sql into your database

Postgres create POSTGIS extension error with CentOS 6

I am running PostgreSQL 9.3 with Postgis 2.0 on CentOS 6.3.
I installed PostgreSQL and PostGIS according to this instructions:
http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21CentOS6pgdg
When trying to create Postgis extension
Create Extension Postgis;
I get the following error,
ERROR: could not load library "/usr/pgsql-9.3/lib/rtpostgis-2.1.so": libhdf5.so.6: cannot open shared object file: No such file or directory
May I know how to install the POSTGIS extension successfully?
I have CentOs 6.5 and did this:
1) Install following packages
hdf5-1.8.11-42.1.x86_64.rpm
json-c-0.10-2.1.x86_64.rpm
libhdf5-8-1.8.11-42.1.x86_64.rpm
libhdf5_hl8-1.8.11-42.1.x86_64.rpm
I don't know if I can link files directly here, so look for those files at rpm.pbone.net, download CentOS 6 version.
2) As Postgis requires version hdf5 version 6, you have to execute this commands as root (# is prompt)
# cd /usr/lib64
# ln -s libhdf5_hl.so.8 libhdf5_hl.so.6
# ln -s libhdf5.so.8 libhdf5.so.6
PS Don't forget to install postgresql contrib package, as Postgis requires fuzzystrmatch extension for some modules.
Have you tried installing the package that contains libhdf5 and then tried running again the create extension command? Apparently postgis is linked to that package which is not present on your system.