[GIS] libiconv-2.dll missing when running shp2pgsql

postgispostgresqlshp2pgsql

My system is Windows 7 with PostgreSQL 9.4 and PostGIS 2.2.

I'm running shp2pgsql program from command line (cmd window, not PSQL interface).

shp2pgsql "D:\file.shp" schema.table > file.sql

I'm getting the following error message (sorry this is in french but it says System error: the programme cannot start for libiconv-2.dll file is missing on the computer. Try to reinstall the program in order to fix the bug):

enter image description here

I have then completely reinstalled PostgreSQL 9.4 and PostGIS 2.2. The libiconv-2.dll is properly installed inside the bin directory (C:\Program Files\PostgreSQL\9.4\bin). I don't understand why this file is not found on the computer and I don't know what else I could do…

Best Answer

I answer my own question based on my comment to @Artec answer.

The issue apparently came from libiconv-2.dll file had been installed in C:\Program Files\PostgreSQL\9.4\bin\postgisgui whereas shp2pgsql.exe is stored in C:\Program Files\PostgreSQL\9.4\bin.

It seems that the executable is looking for the DLL inside its own directory. I may be wrong, but copying libiconv-2.dll file inside bin did bring the solution...