Skip to content

"Unknown PEi386 section name `.text$printf'" error in GHCi on Windows

I work on a Haskell library interfacing with foreign C++ library. While trying to use it in GHCi on Windows 8.1 64bit, I encountered an error message that said:

<loading other libraries>
Loading package library-0.1.0.0 ... <interactive>: Unknown PEi386 section name `
.text$_ZNSt6vectorIcSaIcEED1Ev' (while processing: c:\path\to\file.o)
ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.8.3 for i386-unknown-mingw32):
loadObj "C:\\path\\to\\file.o": failed
 
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug 

I've prepared a minimal example triggering this bug and attached it to this bug report. On Linux (Arch 64bit), after cabal build and cabal repl it behaves as intended:

GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading object (static) dist/build/cbits/ex.o ... done
final link ... done
[1 of 1] Compiling Example          ( Example.hs, interpreted )
Ok, modules loaded: Example.
λ: foo
Test

However, on Windows 8.1 it crashes while loading object file:

GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading object (static) dist\build\cbits\ex.o ... ghc.exe: Unknown PEi386 sectio
n name `.text$printf' (while processing: dist\build\cbits\ex.o)
ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.8.3 for i386-unknown-mingw32):
loadObj "dist\\build\\cbits\\ex.o": failed
 
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug 

Crashing in GHCi means that I cannot use it with programs that contain TH splices, what is important for me.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC hvr
Operating system
Architecture x86_64 (amd64)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information