1

I'm trying to import a ShapeFile inside my PostGIS database using the ogr2ogr, however I'm receiving an error:

ogr2ogr: symbol lookup error: ogr2ogr: undefined symbol: _ZNK17GDALDriverManager14GetDriverCountEv

The command that I'm using is that:

ogr2ogr -append -f "PostgreSQL" PG:"host=127.0.0.1 dbname=DATABASE_NAME user=USER_NAME password=PASSWORD" points.shp -skipfailures

I'm looking for it in Google, but without success.

Would anyone have any idea what is happening?

2
  • Most probably a dependent DLL or SO was missing. It would be helpful if you can tell what OS you are using, how you obtained/install/built the GDAL/OGR tools, and etc.
    – Ralph Tee
    Commented May 18, 2018 at 4:15
  • I use the Ubuntu 16 and I had installed the GDAL/OGR by apt-get. Anyway, I resolved my problem purging and installing the libgdal20 again. I explained the steps below. Thank you so much for your help.
    – rmmariano
    Commented May 23, 2018 at 22:19

2 Answers 2

1

I believe that the problem was in the libgdal20 library, which it had the driver dependency: _ZNK17GDALDriverManager14GetDriverCountEv

Then I had to use a purge in this library and install everything again related to GDAL/OGR. Finally the OGR has started to work.

The following commands solved my problem:

sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update

sudo apt purge libgdal20

sudo apt-get install libgdal20

sudo apt-get install gdal-bin python-gdal python3-gdal postgis

1
  • 1
    thanks, you saved my day
    – tomfumb
    Commented Apr 22, 2020 at 16:38
0

I had to run a different set of commands to try and solve my problem:

sudo rm -r /usr/local/bin/ogr*
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
sudo apt purge libgdal20

sudo apt-get install gdal-bin postgis

Eventually, with apt list --installed | grep gdal I realized that this was installing GDAL 2.4.0 while I was trying to get 3.5.2.

gdal-bin/oldoldstable,now 2.4.0+dfsg-1+deb10u1 amd64 [installed]
gdal-data/oldoldstable,now 2.4.0+dfsg-1+deb10u1 all [installed,automatic]
libgdal20/oldoldstable,now 2.4.0+dfsg-1+deb10u1 amd64 [installed,automatic]

This is because I was using Debian buster and it is oldold at this point, there's no more recent version of GDAL available for it (gdal-bin versions). So, the solution was to create an environment and manually install GDAL. Luckily, this can easily be done with conda:

conda create -n GDAL
conda activate GDAL
conda install -c conda-forge gdal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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