2

I am on windows XP. I have installed Yesod by following the steps on this page: http://www.yesodweb.com/page/five-minutes

I have created a scaffolded application with Postgresql persistence. When I ran "yesod devel" for the first time it gave me an error about some postgresql package missing (I do not remember the name), so I installed it using cabal. now when I run "yesod devel" it gives me the error below:

Loading package HDBC-postgresql-2.2.3.3 ... ghc.exe: pq: The specified module co
uld not be found.
: can't load .so/.DLL for: pq (addDLL: could not load DLL)
yesod: Network.Socket.accept: failed (No error)
I have HDBC-postgresql-2.2.3.3 installed and I have installed it with the --extra-lib-dirs set to the postgresql's bin folder wih all the DLLs but it did not help.

As far as I understand it is trying to load pq.dll, but I do not have it on my system, I have libpq.dll, so I tried to rename the dll, to no avail. I am lost.

Please help

Konstantin

Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
akonsu
  • 28,824
  • 33
  • 119
  • 194
  • Did you try _without_ renaming it? A library `foo` should correspond to `libfoo.dll` on Windows, if I'm not mistaken. – hammar Aug 26 '11 at 03:35
  • Are you able to run code that just uses HDBC-postgresql, without using Yesod or Persistent? That would help localize the issue. – Michael Snoyman Aug 26 '11 at 07:16
  • @Michael: how do I do this? I tried "ghci -package HDBC-postgresql" and it gives me the same error. – akonsu Aug 26 '11 at 07:55
  • @hammar: yes, I tried running without renaming. this is how I discovered the problem :) – akonsu Aug 26 '11 at 08:01
  • @akonsu: If the same problem happened with plain old HDBC-postgresql, it's certainly a library issue. Maybe you need to modify your PATH to include the folder with libpq.dll? Or just copy libpq.dll to the current folder and see if that solves it? – Michael Snoyman Aug 26 '11 at 11:45
  • thanks. setting PATH correctly helped. I have postgresql installed under "Program Files", and for some reason HDBC-postgresql does not like the fact that the path contains a space, so I ended up adding the 8.3 path version to the %path% and it seemed to have solved the problem. please move your comments to an answer so that I could accept it. – akonsu Aug 26 '11 at 20:06

2 Answers2

1

On Windows, %path% needs to be set correctly. I have postgresql installed under "Program Files", and for some reason HDBC-postgresql does not like the fact that the path contains a space, so I ended up adding the 8.3 path version to the %path% and it seemed to have solved the problem.

akonsu
  • 28,824
  • 33
  • 119
  • 194
0

You need to set your windows path correctly. Ghc requires the following path set for postgreSQL ODBC as "C:\Program Files\PostgreSQL\psqlODBC\0903\bin" on the command line(Use ODBC version and change it appropriately). In addition, your postgreSQL bin path should be set. Install the odbc driver after you set the ODBC path. If ODBC dlls are linked properly, the error will disappear. If odbc linking is not done properly, setting cabal flag --extra-lib-dirs will not work. The required file libpq.dll is in odbc bin directory.