Relax static-PE linker object checks
cygwin 1.7
$ iconv --version
iconv (GNU libiconv 1.14)
E:/Develop/haskell/conv.hs :
import Codec.Text.IConv as IConv
import Data.ByteString.Lazy as ByteString
main :: IO ()
main = ByteString.interact (convert "UTF-8" "GBK")
then
GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :load "e:/Develop/haskell/conv.hs"
[1 of 1] Compiling Main ( E:\Develop\haskell\conv.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package iconv-0.4.1.0 ... ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.4.1 for i386-unknown-mingw32):
loadArchive "d:/cygwin/lib\\libiconv.a": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
*Main> Leaving GHCi.
<interactive>: Unknown PEi386 section name `.drectve' (while processing: d:/cygwin/lib\libiconv.a)
- Show closed items
Relates to
- #71037.10.15
- #78897.8.17
- #85467.10.15
- #100517.10.15
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Ian Lynagh <igloo@earth.li> mentioned in issue #3658 (closed)
mentioned in issue #3658 (closed)
- songpp changed weight to 5
changed weight to 5
- songpp added GHCi Tbug Trac import labels
added GHCi Tbug Trac import labels
- Author
Attached file
20120707132609.png
(download).SORRY FOR THE TEXT FORMAT
- Author
Trac metadata
Trac field Value CC → sun.april.moon@gmail.com - Simon Marlow mentioned in issue #7103 (closed)
mentioned in issue #7103 (closed)
Loading package nano-md5-0.1.2 ... <interactive>: Unknown PEi386 section name `.drectve' (while processing: C:\openssl\lib\libcrypto.a) ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.4.1 for i386-unknown-mingw32):
loadArchive "C:\\openssl\\lib\\libcrypto.a": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
with openssl from http://gnuwin32.sourceforge.net/packages/openssl.htm
- Simon Marlow changed milestone to %7.6.2
changed milestone to %7.6.2
- Simon Marlow changed weight to 7
changed weight to 7
- Developer
See also #7103 (closed).
Trac metadata
Trac field Value Priority normal → high Related #2487 (closed) → #2487 (closed), #7103 (closed) - Simon Marlow changed the description
changed the description
- Developer
It also shows up (but with different unknown section) when linking with code built with gcc-4.7.0 on mingw.
This would be fixed by dynamic-by-default.
Trac metadata
Trac field Value BlockedBy → #3658 (closed) Experienced this with Mingw GCC 4.7.2 on Windows 7 when building GHC:
"inplace/bin/ghc-stage2.exe" -hisuf hi -osuf o -hcsuf hc -static -H32m -O -package-name vector-0.9.1 -hide-all-packages -i -ilibraries/vector/. -ilibraries/vector/dist-install/build -ilibraries/vector/dist-install/build/autogen -Ilibraries/vector/dist-install/build -Ilibraries/vector/dist-install/build/autogen -Ilibraries/vector/include -Ilibraries/vector/internal -optP-DVECTOR_BOUNDS_CHECKS -optP-include -optPlibraries/vector/dist-install/build/autogen/cabal_macros.h -package base-4.7.0.0 -package ghc-prim-0.3.1.0 -package primitive-0.4.0.1 -O2 -XHaskell98 -XCPP -XDeriveDataTypeable -O2 -no-user-package-db -rtsopts -odir libraries/vector/dist-install/build -hidir libraries/vector/dist-install/build -stubdir libraries/vector/dist-install/build -dynamic-too -c libraries/vector/./Data/Vector/Fusion/Stream/Monadic.hs -o libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.o -dyno libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.dyn_o Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... ghc-stage2.exe: panic! (the 'impossible' happened) (GHC version 7.7.20130413 for i386-unknown-mingw32): loadArchive "C:\\MinGW\\msys\\1.0\\home\\Max\\Programming\\ghc\\libraries\\integer-gmp\\dist-install\\build\\libHSinteger-gmp-0.5.1.0.a": failed Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug ghc-stage2.exe: Unknown PEi386 section name `.drectve' (while processing: C:\MinGW\msys\1.0\home\Max\Programming\ghc\libraries\integer-gmp\dist-install\build\libHSinteger-gmp-0.5.1.0.a)
- thoughtpolice mentioned in issue #7889 (closed)
mentioned in issue #7889 (closed)
May be related. Building GHC with mingw gcc 4.8.0 and ghc 7.6.3 on Windows 8 yields:
Loading package integer-gmp ... ghc-stage2.exe: Unknown PEi386 section name `.dr ectve' (while processing: C:\MinGW\msys\1.0\home\Kyle\ghc\libraries\integer-gmp\ dist-install\build\libHSinteger-gmp-0.5.1.0.a) ghc-stage2.exe: panic! (the 'impossible' happened) (GHC version 7.7.20130711 for i386-unknown-mingw32): loadArchive "C:\\MinGW\\msys\\1.0\\home\\Kyle\\ghc\\libraries\\integer-g mp\\dist-install\\build\\libHSinteger-gmp-0.5.1.0.a": failed Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug make[1]: *** [libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Mona dic.o] Error 1 make: *** [all] Error 2
I looked into this. See http://msdn.microsoft.com/en-us/library/ms809762.aspx
The
.drective
section only appears in OBJ files. It contains text representations of commands for the linker. For example, in any OBJ I compile with the Microsoft compiler, the following strings appear in the.drectve
section...This is with Microsoft compilers. Presumably, MinGW or something is doing this now too? Some searching suggests
ld
generally doesn't understand the directives placed in.drectve
, although maybe something changed or it puts something else there.It's probably just best to ignore the section (a simple fix); I'll try to get GCC 4.8 on my Windows build machine and reproduce it.
- Developer
Wait! The
ghc-tarballs
repo containsgcc
for exactly this reason. The build system is supposed to use that, not any randomgcc
that comes withmingw
. So why is it using the mingw one?Simon
In my case I manually modified GHC directory layout so that "mingw" points to recent mingw installation. It contained GCC 4.7. It's important if one wants to use C++ libraries built with more recent GCC.
As far as I know one can't mix code built with different GCC major versions so forcing use of GCC 4.5 isn't exactly the solution.
- thoughtpolice changed milestone to %7.8.1
changed milestone to %7.8.1
Perhaps then we should simply upgrade the GCC release included in ghc-tarballs. I'm not sure if I will get to this before 7.8.1 (there's some cleanup on top of the fix for this that's needed,) although tenatively we can try.
- thoughtpolice assigned to @trac-thoughtpolice
assigned to @trac-thoughtpolice
- Developer
We should probably just ignore section names that we don't understand. I think the linker is just being extra paranoid in making sure it understands the whole contents of the object file, but this breaks with pretty much every new gcc/binutils.
- Simon Marlow changed weight to 10
changed weight to 10
- Developer
Trac metadata
Trac field Value Priority high → highest Trac metadata
Trac field Value Related #2487 (closed), #7103 (closed) → #2487 (closed), #7103 (closed), #7889 (closed) - Edward Z. Yang mentioned in commit 24b791f9
mentioned in commit 24b791f9
- Edward Z. Yang changed weight to 7
changed weight to 7
- Developer
Trac metadata
Trac field Value Priority highest → high - Edward Z. Yang mentioned in issue #8530 (closed)
mentioned in issue #8530 (closed)
- Developer
Trac metadata
Trac field Value Blocking → #8530 (closed) - Mokosha mentioned in issue #8546 (closed)
mentioned in issue #8546 (closed)
I just got this trying to load
libHSpersistent-sqlite-1.2.1.a
. Any idea when it will be solved?- Developer
3noch: The fix for drectve should have made it into GHC 7.8.2. This bug is still open because we ostensibly want to relax the Windows linker's object checks.
- thoughtpolice changed title from GHCi loadArchive "libiconv.a":failed Unknown PEi386 section name `.drectve' to Relax static-PE linker object checks
changed title from GHCi loadArchive "libiconv.a":failed Unknown PEi386 section name `.drectve' to Relax static-PE linker object checks
- thoughtpolice changed milestone to %7.10.1
changed milestone to %7.10.1
- thoughtpolice changed weight to 5
changed weight to 5
Trac metadata
Trac field Value TypeOfFailure GhciCrash → OtherFailure Priority high → normal BlockedBy #3658 (closed) → Blocking #8530 (closed) → - thoughtpolice removed GHCi label
removed GHCi label
- thoughtpolice mentioned in issue #9907 (closed)
mentioned in issue #9907 (closed)
- thoughtpolice removed milestone
removed milestone
Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.
- thoughtpolice mentioned in issue #10051 (closed)
mentioned in issue #10051 (closed)
- Tamar Christina mentioned in commit a293925d
mentioned in commit a293925d
- thoughtpolice closed
closed
- thoughtpolice changed milestone to %7.10.1
changed milestone to %7.10.1
Duplicate of #9907 (closed), which will be merged to 7.10.1.
Trac metadata
Trac field Value Resolution Unresolved → ResolvedDuplicate Related #2487 (closed), #7103 (closed), #7889 (closed) → #2487 (closed), #7103 (closed), #7889 (closed), #8546 (closed), #9907 (closed)