2

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...

4
  • Is that the exact command you are running, or are you running it using path references? It sounds like your working directory (and PATH) aren't the same as the executable. Dec 10, 2015 at 12:24
  • I run the program from inside bin directory (same problem when I run "C:\Program Files\PostgreSQL\9.4\bin\shp2pgs.exe" "D:\file.shp" schema.table > file.sql.
    – wiltomap
    Dec 10, 2015 at 13:09
  • make sure it's the same dll...does the spelling match exactly? Is there a hyphen in the dll you have? Dec 10, 2015 at 18:40
  • Are you using 32-bit 9.4 or 64-bit 9.4? Only thought I have is maybe something up with the permissions on the dll you have.
    – LR1234567
    Dec 11, 2015 at 6:19

2 Answers 2

4

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...

1
  • Copying the libiconv-2.dll into the bin folder also helped when getting just a basic the application was unable to start correctly error message trying to start the shp2pgsql command. Win10, PostgreSQL 9.4, PostGIS 2.2 Mar 5, 2018 at 10:33
2

Look at portable version postgis and unzip files to ex. C:\Postgis

Postgis

Nextly copy libiconv-2.dll to C:\Postgis\bin (libiconv-2.dll you can find in QGIS installation). Put .shp, .dbf, .shx files to C:\Postgis\bin and run your command C:\Postgis\bin>shp2pgsql "Test.shp" schema.table > file.sql. Use simple shp filename. In result:

Shapefile type: Polygon

Postgis type: MULTIPOLYGON[2]

file.sql is created

Works on W10 64 bit, I think that it should works on W7 64 bit to.

2
  • Thanks for this answer that made me trying to change the DLL directory. The libiconv-2.dll file was in C:\Program Files\PostgreSQL\9.4\bin\postgisgui. I tried to move the file to C:\Program Files\PostgreSQL\9.4\bin and it eventually worked fine... I did not need to copy the QGIS directory version of the DLL.
    – wiltomap
    Dec 15, 2015 at 7:58
  • Then good luck.
    – Artec
    Dec 15, 2015 at 10:27

Your Answer

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

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