Open smoothdeveloper opened 10 years ago
Well, I'm going to guess that aa96786e7bb98d75ba4c220ecf57e17c38f843fb and 1a390f5e1129edae493605a4101098eb844a58a7 triggered the problem you are seeing. I feel pretty confident about that guess.
The true cause of the problem seems to be that, for whatever reason, Template Haskell isn't working due to a linking error. Unfortunately I don't know much about why that might be. Can you compile other modules/packages that use Template Haskell?
Here's an idea, have you actually been able to use vanilla postgresql-libpq
to successfully connect to a database? And are you using libpq
9.0 or later?
Thanks for further review.
Yes I've been using yesod and other packages which do use Template Haskell.
I'll give a shot at postgresql-libpq itself and report here, I'm using 9.0.2 release of postgresql which I referenced in order to compile the haskell package.
Ok, if postgresql-libpq
does turn out to be a problem, you may or may not find #66 to be helpful in getting it to work. If this is the problem, I would definitely be interested in your review of the instructions there.
I'm getting this issue using postgresql-libpq
*TestPg> connectdb connectionString
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package postgresql-libpq-0.9.0.1 ... <interactive>: Unknown PEi386 secti
on name `.idata$4' (while processing: C:/dev/bin/POSTGR~1.1/lib\libpq.a)
ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.6.3 for i386-unknown-mingw32):
loadArchive "C:/dev/bin/POSTGR~1.1/lib\\libpq.a": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
I'm not sure how I should check the libpq.a contains what it's supposed to contain but it seems to be the one which come with postgresql release (it's 9.2.4.1 BTW), there might be issue with conflicting versions of mingw between haskell platform and the one used to compile postgresql binaries?
This stackoverflow question with same error message mention that I would need to define a linker script somewhere:
Yeah, I'm pretty sure that's causing the postgresql-simple compilation error. As to what's causing this error, I dunno. Where did you get the libpq object code you are using? Did you compile it yourself or did you download a precompiled object from somewhere?
Several people are successfully using postgresql-libpq on Windows. Have you tried the description that Joey Adams posted about how he does it in #66?
My bad, I was trying to link with x64 binaries...
I'm not sure what could be done upper in the chain so it won't come with this misleading linker error message.
So applying the instructions from #66 plainly works now :)
Hopefully, if someone hits the same issue / overlook, this page will provide the solution.
Oh, no problem. I am happy you got it working, and I am aware that a number of people have had trouble with postgresql-libpq on Windows. =)
Ok, inspired partly by this report and several other similar reports, I did open up lpsmith/postgresql-libpq#20 and lpsmith/postgresql-libpq#21 to help avoid/diagnose these problems in the future.
This is how it goes with current master:
I've tried building various tags, and the first which builds is version 0.3.6, failing from 0.3.7
I've to figure out what dependency in FromField might cause the trouble, as I believe it's related to this file (according to the build output which fails while compiling this module.