Open eflister opened 12 years ago
I don't really know about this, though I do know that @joeyadams uses postgresql-libpq on windows so maybe he knows something about it.
I did google Unknown PEi386 section name
, and it turns up mostly ghc-specific links for other packages. So maybe one of those would help.
Out of curiosity, did you ever get these issues resolved?
nope -- i gave up and switched to mongo. here's how far i got:
From: erik flister Date: Fri, Nov 2, 2012 at 1:17 PM To: dtrebbien
hi daniel - i was following your instructions here: https://github.com/hdbc/hdbc-postgresql/wiki/WindowsInstall (super helpful, thanks!) except when cabal tries to link, i get:
Loading package postgresql-libpq-0.8.2.1 ... ghc.exe: Unknown PEi386 section name `.idata$4' (while processing: c:/PROGRA~2/POSTGR~1/9.1/lib\libpq.a) ghc.exe: panic! (the 'impossible' happened) (GHC version 7.4.1 for i386-unknown-mingw32): loadArchive "c:/PROGRA~2/POSTGR~1/9.1/lib\libpq.a": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
do you know where i could look to start trying to fix this? thanks for your help! -erik
From: Daniel Trebbien Date: Sat, Nov 3, 2012 at 6:21 AM To: erik flister
Hello Erik,
With the latest version of Haskell Platform I, too, am seeing this error. This appears to be GHC bug 7103. In essence, GHC apparently does not support Portable Executable "grouped sections".
I have asked a question on Stack Overflow with some more details: http://stackoverflow.com/questions/13209425/program-to-merge-grouped-portable-executable-sections-and-output-the-merged-libr. Unfortunately, unless and until I get an answer to this question, I do not know of any work-arounds.
Thank you for contacting me about this, though. I will keep trying to find a solution to this issue, and will let you know if I come up with one.
Sincerely,
Daniel Trebbien
From: Daniel Trebbien Date: Sat, Nov 3, 2012 at 6:39 AM To: erik flister
I saw a note on http://oldwiki.mingw.org/index.php/CreateImportLibraries?redirectfrom=create+import+DLL-libraries that MinGW usually links fine against a DLL, which led me to trying the steps without creating libpq.a. Lo and behold, it worked!
So, just skip the steps to create libpq.a and delete this file from C:\Program Files (x86)\PostgreSQL\9.1\lib if already added. Then reinstall HDBC-postgresql:
cabal install HDBC-postgresql --extra-include-dirs=C:\Progra~2\PostgreSQL\9.1\include --extra-lib-dirs=C:\Progra~2\PostgreSQL\9.1\lib --force-reinstalls --reinstall
Please try that and let me know if it works. It worked with a test HaskellDB project of mine, https://github.com/dtrebbien/haskelldb-example, so I think that it works, but I haven't used this method before.
Daniel
From: erik flister Date: Sat, Nov 3, 2012 at 9:26 AM To: Daniel Trebbien
hey, thanks for looking into it! i tried removing the .a, reinstalling, and now i get:
Loading package postgresql-libpq-0.8.2.1 ... linking ... ghc.exe: C:\Users\nlab\ AppData\Roaming\cabal\postgresql-libpq-0.8.2.1\ghc-7.4.1\HSpostgresql-libpq-0.8. 2.1.o: unknown symbol _lo_import_with_oid' ghc.exe: unable to load packagepostgresql-libpq-0.8.2.1'
i am trying to use persistent-postgresql, not hdbc, though...
Well, it sounds like it's a ghc bug. Have you tried using a different version of GHC? Or perhaps a different binary of the libpq C library? (Did you compile libpq yourself? If you didn't, where did you get your binary? If you did, which tools did you use to produce the binary?)
I'll keep this issue open for the time being; but I myself am not inclined to do anything until GHC bug 7103 is fixed, and then worry if this problem doesn't go away.
Incidentally, I do know that Joey Adams is using postgresql-libpq on windows, and I believe he's using PostgreSQL 8.4. You might also consider trying an older version of libpq if you are still interested.
There shouldn't be too many issues using libpq 8.4 to connect to a postgresql 9.1 backend, by the way. If you run into any, there is a good chance that the problem would be in postgresql-simple, so I would love to hear about it.
don't have time to look into it now, but might come back to it, esp if ghc fixes 7103. for now i am running the haskell side in a virtualized ubuntu. :) if i remember right, http://www.enterprisedb.com/products-services-training/pgdownload#windows installed libpq.dll, and then i tried daniel's way of making the .a with mingw. i didn't see any way to message joey.
Instructions for compiling postgresql-libpq were posted by Joey Adams in pull request 66 for postgresql-simple. If you get a chance, please try it out and let me know how it goes!
This is how it goes with current master:
cabal configure
cabal build --verbose
Component build order: library
creating dist\build
creating dist\build\autogen
Building postgresql-simple-0.4.2.2...
Preprocessing library postgresql-simple-0.4.2.2...
Building library...
creating dist\build
C:\dev\bin\haskell-2013.2.0.0\bin\ghc.exe --make -fbuilding-cabal-package -O -outputdir dist\build -odir dist\build -hidir dist\build -stubdir dist\build -i -idist\build -isrc -idist\build\autogen -Idist\build\autogen -Idist\build -optP-include -optPdist\build\autogen\cabal_macros.h -package-name postgresql-simple-0.4.2.2 -hide-all-packages -package-db dist\package.conf.inplace -package-id aeson-0.6.2.1-878117afb106a49080d570b0d0c89775 -package-id attoparsec-0.10.4.0-b7d4a7202f217cfeff7b1b1d6379bc87 -package-id base-4.6.0.1-f0c2cc6dcf0e12bf75312a2e7f354095 -package-id blaze-builder-0.3.3.2-a5c5f6db86ce4ef94f55fe01154717b2 -package-id blaze-textual-0.2.0.9-aa8f5b545854c0bf278d4bf1afa0aff7 -package-id bytestring-0.10.0.2-c8fbf42ac6de7e76dd9245b3f7a2fa84 -package-id containers-0.5.0.0-216fcd375644c41421c5f14613e6b5af -package-id hashable-1.1.2.5-e8326d7b0c6af07b9139e791b5b3ad95 -package-id postgresql-libpq-0.9.0.1-822b83f11d3322cf00f1c3a90902628c -package-id scientific-0.2.0.2-2ae95b341de67ca0889d39ff72f50fb9 -package-id template-haskell-2.8.0.0-42f1e6e55511ef4dff7e4249580faf8f -package-id text-0.11.3.1-a8ece294fe3000125614f30af4cc5e8b -package-id time-1.4.0.1-ecfe3938f222e49c5674480c0da9b8a4 -package-id transformers-0.3.0.0-df161533671a3b9bce217538864873c4 -package-id uuid-1.3.3-7578bb0016e132286aab139511e37350 -package-id vector-0.10.0.1-de357a28bd1947d0c1ee9b730f605fb0 -XHaskell98 -XDoAndIfThenElse -XOverloadedStrings -XBangPatterns -XViewPatterns -XTypeOperators Database.PostgreSQL.Simple Database.PostgreSQL.Simple.Arrays Database.PostgreSQL.Simple.BuiltinTypes Database.PostgreSQL.Simple.Copy Database.PostgreSQL.Simple.FromField Database.PostgreSQL.Simple.FromRow Database.PostgreSQL.Simple.LargeObjects Database.PostgreSQL.Simple.HStore Database.PostgreSQL.Simple.HStore.Internal Database.PostgreSQL.Simple.Notification Database.PostgreSQL.Simple.Ok Database.PostgreSQL.Simple.SqlQQ Database.PostgreSQL.Simple.Time Database.PostgreSQL.Simple.Time.Internal Database.PostgreSQL.Simple.ToField Database.PostgreSQL.Simple.ToRow Database.PostgreSQL.Simple.Transaction Database.PostgreSQL.Simple.TypeInfo Database.PostgreSQL.Simple.TypeInfo.Macro Database.PostgreSQL.Simple.TypeInfo.Static Database.PostgreSQL.Simple.Types Database.PostgreSQL.Simple.Errors Database.PostgreSQL.Simple.Internal Database.PostgreSQL.Simple.Compat Database.PostgreSQL.Simple.HStore.Implementation Database.PostgreSQL.Simple.Time.Implementation Database.PostgreSQL.Simple.TypeInfo.Types -Wall -fno-warn-name-shadowing
[ 1 of 32] Compiling Database.PostgreSQL.Simple.TypeInfo.Types ( src\Database\PostgreSQL\Simple\TypeInfo\Types.hs, dist\build\Database\PostgreSQL\Simple\TypeInfo\Types.o ) [flags changed]
[ 2 of 32] Compiling Database.PostgreSQL.Simple.Time.Implementation ( src\Database\PostgreSQL\Simple\Time\Implementation.hs, dist\build\Database\PostgreSQL\Simple\Time\Implementation.o ) [flags changed]
[ 3 of 32] Compiling Database.PostgreSQL.Simple.Time.Internal ( src\Database\PostgreSQL\Simple\Time\Internal.hs, dist\build\Database\PostgreSQL\Simple\Time\Internal.o ) [flags changed]
[ 4 of 32] Compiling Database.PostgreSQL.Simple.SqlQQ ( src\Database\PostgreSQL\Simple\SqlQQ.hs, dist\build\Database\PostgreSQL\Simple\SqlQQ.o ) [flags changed]
[ 5 of 32] Compiling Database.PostgreSQL.Simple.Time ( src\Database\PostgreSQL\Simple\Time.hs, dist\build\Database\PostgreSQL\Simple\Time.o ) [flags changed]
[ 6 of 32] Compiling Database.PostgreSQL.Simple.TypeInfo.Static ( src\Database\PostgreSQL\Simple\TypeInfo\Static.hs, dist\build\Database\PostgreSQL\Simple\TypeInfo\Static.o ) [flags changed]
[ 7 of 32] Compiling Database.PostgreSQL.Simple.BuiltinTypes ( src\Database\PostgreSQL\Simple\BuiltinTypes.hs, dist\build\Database\PostgreSQL\Simple\BuiltinTypes.o ) [flags changed]
[ 8 of 32] Compiling Database.PostgreSQL.Simple.Arrays ( src\Database\PostgreSQL\Simple\Arrays.hs, dist\build\Database\PostgreSQL\Simple\Arrays.o ) [flags changed]
[ 9 of 32] Compiling Database.PostgreSQL.Simple.Types ( src\Database\PostgreSQL\Simple\Types.hs, dist\build\Database\PostgreSQL\Simple\Types.o ) [flags changed]
[10 of 32] Compiling Database.PostgreSQL.Simple.TypeInfo.Macro ( src\Database\PostgreSQL\Simple\TypeInfo\Macro.hs, dist\build\Database\PostgreSQL\Simple\TypeInfo\Macro.o ) [flags changed]
[11 of 32] Compiling Database.PostgreSQL.Simple.ToField[boot] ( src\Database\PostgreSQL\Simple\ToField.hs-boot, dist\build\Database\PostgreSQL\Simple\ToField.o-boot ) [flags changed]
[12 of 32] Compiling Database.PostgreSQL.Simple.ToRow[boot] ( src\Database\PostgreSQL\Simple\ToRow.hs-boot, dist\build\Database\PostgreSQL\Simple\ToRow.o-boot ) [flags changed]
[13 of 32] Compiling Database.PostgreSQL.Simple.ToField ( src\Database\PostgreSQL\Simple\ToField.hs, dist\build\Database\PostgreSQL\Simple\ToField.o ) [flags changed]
[14 of 32] Compiling Database.PostgreSQL.Simple.ToRow ( src\Database\PostgreSQL\Simple\ToRow.hs, dist\build\Database\PostgreSQL\Simple\ToRow.o ) [flags changed]
[15 of 32] Compiling Database.PostgreSQL.Simple.Ok ( src\Database\PostgreSQL\Simple\Ok.hs, dist\build\Database\PostgreSQL\Simple\Ok.o ) [flags changed]
[16 of 32] Compiling Database.PostgreSQL.Simple.Internal ( src\Database\PostgreSQL\Simple\Internal.hs, dist\build\Database\PostgreSQL\Simple\Internal.o ) [flags changed]
[17 of 32] Compiling Database.PostgreSQL.Simple.LargeObjects ( src\Database\PostgreSQL\Simple\LargeObjects.hs, dist\build\Database\PostgreSQL\Simple\LargeObjects.o ) [flags changed]
[18 of 32] Compiling Database.PostgreSQL.Simple.Notification ( src\Database\PostgreSQL\Simple\Notification.hs, dist\build\Database\PostgreSQL\Simple\Notification.o ) [flags changed]
[19 of 32] Compiling Database.PostgreSQL.Simple.Errors ( src\Database\PostgreSQL\Simple\Errors.hs, dist\build\Database\PostgreSQL\Simple\Errors.o ) [flags changed]
[20 of 32] Compiling Database.PostgreSQL.Simple.Compat ( src\Database\PostgreSQL\Simple\Compat.hs, dist\build\Database\PostgreSQL\Simple\Compat.o ) [flags changed]
[21 of 32] Compiling Database.PostgreSQL.Simple.Transaction ( src\Database\PostgreSQL\Simple\Transaction.hs, dist\build\Database\PostgreSQL\Simple\Transaction.o ) [flags changed]
[22 of 32] Compiling Database.PostgreSQL.Simple.FromField[boot] ( src\Database\PostgreSQL\Simple\FromField.hs-boot, dist\build\Database\PostgreSQL\Simple\FromField.o-boot )
[23 of 32] Compiling Database.PostgreSQL.Simple.FromRow[boot] ( src\Database\PostgreSQL\Simple\FromRow.hs-boot, dist\build\Database\PostgreSQL\Simple\FromRow.o-boot )
[24 of 32] Compiling Database.PostgreSQL.Simple[boot] ( src\Database\PostgreSQL\Simple.hs-boot, dist\build\Database\PostgreSQL\Simple.o-boot )
[25 of 32] Compiling Database.PostgreSQL.Simple.TypeInfo ( src\Database\PostgreSQL\Simple\TypeInfo.hs, dist\build\Database\PostgreSQL\Simple\TypeInfo.o ) [flags changed]
[26 of 32] Compiling Database.PostgreSQL.Simple.FromField ( src\Database\PostgreSQL\Simple\FromField.hs, dist\build\Database\PostgreSQL\Simple\FromField.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
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 containers-0.5.0.0 ... linking ... done.
Loading package binary-0.7.1.0 ... linking ... done.
Loading package byteable-0.1.1 ... linking ... done.
Loading package cryptohash-0.11.1 ... linking ... done.
Loading package text-0.11.3.1 ... linking ... done.
Loading package hashable-1.1.2.5 ... linking ... done.
C:/dev/bin/haskell-2013.2.0.0/mingw/bin/../lib/libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
I've tried building various tags, and the first which builds is version 0.3.6, failing from 0.3.7
@smoothdeveloper Have you successfully built postgresql-libpq? It looks like you've posted this in the wrong repo.
If you have successfully compiled postgresql-libpq, I'd suggest opening an issue on the postgresql-simple issue tracker. I'll try to help as best I can, but I don't use this software on Windows, although others do.
Sorry for mixing-up repository... Yes I did build postgresql-libpq successfully.
I'll post the issue on appropriate repository.
An error still exists on Haskell Platform 2014.2.0.0 (win-64).
I note that problem occurs on postgresql-simlpe installation while compiling module FromField when loading modules in Template Haskell. So maybe dividing FromField.hs to separate TH-code from "import ... LibPQ" could be a workaround?
@odr, see lpsmith/postgresql-simple#111, and compilation instructions for postgresql-libpq in lpsmith/postgresql-simple#66.
Something could be done to make the source of this failure more obvious, but it's very likely that while you compiled postgresql-libpq, it's not useable due to a link error.
I am sorry, I already found a "decision"...
Just removed win-32 and install win-64 PostgreSQL. Using win-64 HP I reinstalled postgresql-libpq without any "libpq.a". Then install postgresql-simple and all went smoothly.
i followed the instructions here: https://github.com/hdbc/hdbc-postgresql/wiki/WindowsInstall
and when cabal tries to link, i get: Loading package postgresql-libpq-0.8.2.1 ... ghc.exe: Unknown PEi386 section name `.idata$4' (while processing: c:/PROGRA~2/POSTGR~1/9.1/lib\libpq.a) ghc.exe: panic! (the 'impossible' happened) (GHC version 7.4.1 for i386-unknown-mingw32): loadArchive "c:/PROGRA~2/POSTGR~1/9.1/lib\libpq.a": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug