Trouble using HDBC-postgres on Windows - can't find libpq.dll

I've compiled HDBC 1.0.1 and HDBC-postgresql-1.0.1 under Windows with a little tweaking. However, when I try to run the tests I get this error:
runghc -package HDBC-postgresql runtests.hs ghc.exe: can't load .so/.DLL for: pq (addDLL: unknown error)
libpq.dll is in my path, and I added the correct paths to the .cabal file when I built it. Does anyone have an idea what might be the problem? Justin p.s. I have postgres 8.2 installed if that matters.

Well, I answered my own question. Unlike UNIX, specifying a library
without the leading "lib" causes the library to not be found. Not sure
if that's a GHC linking problem or what. Changing the library
requirement to "libpq" in the .cabal file did the trick tho.
Justin
---------- Forwarded message ----------
From: Justin Bailey
runghc -package HDBC-postgresql runtests.hs ghc.exe: can't load .so/.DLL for: pq (addDLL: unknown error)
libpq.dll is in my path, and I added the correct paths to the .cabal file when I built it. Does anyone have an idea what might be the problem? Justin p.s. I have postgres 8.2 installed if that matters.

From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe-bounces@haskell.org] On Behalf Of Justin Bailey
Well, I answered my own question. Unlike UNIX, specifying a library without the leading "lib" causes the library to not be found. Not sure if that's a GHC linking problem or what. Changing the library requirement to "libpq" in the .cabal file did the trick tho.
This seems to be a bit different from what I discovered when cabalising Takusen. ghc uses gnu ld, which seems to be smart enough to know that -lpq means "find libpq.dll or pq.dll". ghci's linker/loader isn't so slick. If you say -lpq to ghci, it looks for pq.dll only. So I just copied libpq.dll to pq.dll, so that they both exist. You're using runghc, so I guess that must use ghci, or something equivalent. You may find, now that you've changed the cabal entry to libpq, that you can no longer build with ghc (the compiler). But my memory of this is hazy. I think it's better to stick with "pq" in the cabal file (and copy libpq.dll to pq.dll), because this works for Unix systems too. Alistair ***************************************************************** Confidentiality Note: The information contained in this message, and any attachments, may contain confidential and/or privileged material. It is intended solely for the person(s) or entity to which it is addressed. Any review, retransmission, dissemination, or taking of any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you received this in error, please contact the sender and delete the material from any computer. *****************************************************************

On Nov 13, 2007 7:09 AM, Bayley, Alistair
You're using runghc, so I guess that must use ghci, or something equivalent. You may find, now that you've changed the cabal entry to libpq, that you can no longer build with ghc (the compiler). But my memory of this is hazy. I think it's better to stick with "pq" in the cabal file (and copy libpq.dll to pq.dll), because this works for Unix systems too.
Luckily, GHC doesn't break with this change. However, I agree the cabal file should remain unchanged. I fixed it locally and plan to send a patch to the README included with the library to the author. If you can't fix it in the code, there is always the documentation right? :) Justin
participants (2)
-
Bayley, Alistair
-
Justin Bailey