pramsey / pgsql-ogr-fdw

PostgreSQL foreign data wrapper for OGR
MIT License
237 stars 34 forks source link

undefined symbol: GEOSConcaveHull installing from redhat repo #245

Closed rinaldsb closed 1 year ago

rinaldsb commented 1 year ago

Hi, i have had problem with using your extension while installing it from postgresql.org official repo:

# installed postgresql from  redhat repo
dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf config-manager --set-disabled pgdg10 pgdg11 pgdg12 pgdg13 pgdg15
dnf makecache
dnf install postgresql14 postgresql14-server postgresql14-contrib postgresql14-devel postgis33_14 ogr_fdw_14

# as postgres
mkdir ~/shp
wget https://www.geofabrik.de/data/shapefiles_dresden.zip -O ~/shp/shapefiles_dresden.zip
(cd ~/shp; unzip -q shapefiles_dresden.zip)

createdb impshp

(cat << 'EOF'
CREATE EXTENSION postgis;
CREATE EXTENSION ogr_fdw;
EOF
) | psql impshp

# extensions
for a in $(echo "select datname from pg_database where datname not like 'template%' order by datname;" | psql -tA ) 
do 
echo "#--$a extensions-------------------------------------------------"
echo "select extname,extversion from pg_extension" | psql -t $a  
done

#--impshp extensions---
 plpgsql | 1.0
 postgis | 3.3.2
 ogr_fdw | 1.1

echo "SELECT postgis_full_version();"  | psql -tqA impshp
POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="140" GEOS="3.11.1-CAPI-1.17.1" PROJ="9.0.1" LIBXML="2.9.7" LIBJSON="0.13.1" LIBPROTOBUF="1.3.0" WAGYU="0.5.0 (Internal)"

(cat << 'EOF'
CREATE SERVER IF NOT EXISTS shapes
  FOREIGN DATA WRAPPER ogr_fdw
  OPTIONS (
    datasource '/home/postgres/shp'
    ,format 'ESRI Shapefile'
    );
EOF
) | psql impshp  

(cat << 'EOF'
IMPORT FOREIGN SCHEMA "ogr_all"
FROM SERVER shapes INTO public;
EOF
) | psql impshp

NOTICE:  Number of tables to be created 29
ERROR:  could not load library "/usr/pgsql-14/lib/postgis-3.so": /usr/pgsql-14/lib/postgis-3.so: undefined symbol: GEOSConcaveHull
pramsey commented 1 year ago

This is a build issue with the RPMs you have installed. PostGIS appears to have been built against GEOS 3.11, but your system seems to have an older version of GEOS installed. It's also possible, if you're mixing builds from different places that you have an old GEOS floating around your system somewhere that is finding its way in front of GEOS 3.11 in your linker rules. If you have a clean machine with only PGDG RPMs on it, then the PGDG build is currently borked and short be reported there.

rinaldsb commented 1 year ago

I have tested the problem on freshly installed Rocky linux 8.6 VM, and it had the same problem:

# pgsql
dnf install -y dnf-plugins-core
dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf config-manager --set-disabled pgdg10 pgdg11 pgdg12 pgdg13 pgdg15
dnf -y module disable postgresql
# epel/powertools
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf config-manager --set-enabled powertools
# install postgres/postgis/ogr_fdw
dnf install postgresql14 postgresql14-server postgresql14-contrib postgresql14-devel postgis33_14 ogr_fdw_14

/usr/pgsql-14/bin/postgresql-14-setup initdb
systemctl start postgresql-14

su - postgres
export PATH=/usr/pgsql-14/bin:$PATH

createdb impshp

(cat << 'EOF'
CREATE EXTENSION postgis;
CREATE EXTENSION ogr_fdw;
EOF
) | psql impshp

mkdir ~/shp
wget https://www.geofabrik.de/data/shapefiles_dresden.zip -O ~/shp/shapefiles_dresden.zip
(cd ~/shp; unzip -q shapefiles_dresden.zip)

export PATH=/usr/pgsql-14/bin:$PATH

echo "SELECT postgis_full_version();"  | psql -tqA impshp
POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="140" GEOS="3.11.1-CAPI-1.17.1" PROJ="9.0.1" LIBXML="2.9.7" LIBJSON="0.13.1" LIBPROTOBUF="1.3.0" WAGYU="0.5.0 (Internal)"

(cat << EOF
CREATE SERVER IF NOT EXISTS shapes
  FOREIGN DATA WRAPPER ogr_fdw
  OPTIONS (
    datasource '$(echo ~/shp)'
    ,format 'ESRI Shapefile'
    );
EOF
) | psql impshp  

(cat << 'EOF'
IMPORT FOREIGN SCHEMA "ogr_all"
FROM SERVER shapes INTO public;
EOF
) | psql impshp

NOTICE:  Number of tables to be created 29
ERROR:  could not load library "/usr/pgsql-14/lib/postgis-3.so": /usr/pgsql-14/lib/postgis-3.so: undefined symbol: GEOSConcaveHull
LINE 3:   geom Geometry(Polygon,4326),
               ^
QUERY:  CREATE FOREIGN TABLE gis_osm_adminareas_a_07_1 (
  fid bigint,
  geom Geometry(Polygon,4326),
  osm_id varchar(10),
  lastchange varchar(20),
  code integer,
  fclass varchar(28),
  geomtype varchar(1),
  postalcode varchar(10),
  name varchar(100)
) SERVER shapes
OPTIONS (layer 'gis_osm_adminareas_a_07_1');

CONTEXT:  importing foreign table "gis_osm_adminareas_a_07_1"

Where should i addresss this issue ?