GHC panic while building the base library with Cabal
On a project here, we are building a custom version of ghc. Part of our build process involves building the base library with Cabal, which produces the following error message:
[ 57 of 128] Compiling Data.Either ( Data/Either.hs, dist/build/Data/Either.o )
[ 58 of 128] Compiling System.IO.Error ( System/IO/Error.hs, dist/build/System/IO/Error.o )
[ 59 of 128] Compiling Text.Read ( Text/Read.hs, dist/build/Text/Read.o )
[ 60 of 128] Compiling Foreign.Ptr ( Foreign/Ptr.hs, dist/build/Foreign/Ptr.o )
ghc: panic! (the 'impossible' happened)
(GHC version 6.10.4 for x86_64-unknown-linux):
tcIfaceGlobal (local): not found:
base:GHC.Word.W#{d 6w}
[(32R, Type constructor `base:GHC.Word.Word{tc 32R}'),
(32U, Type constructor `base:GHC.Word.Word8{tc 32U}'),
(32X, Type constructor `base:GHC.Word.Word16{tc 32X}'),
(333, Type constructor `base:GHC.Word.Word32{tc 333}'),
(339, Type constructor `base:GHC.Word.Word64{tc 339}'),
(r1ujj, Data constructor `base:GHC.Word.W64#{d r1ujj}'),
(r1ujl, Data constructor `base:GHC.Word.W32#{d r1ujl}'),
(r1ujn, Data constructor `base:GHC.Word.W16#{d r1ujn}'),
(r1ujp, Data constructor `base:GHC.Word.W8#{d r1ujp}'),
(r1ujr, Data constructor `base:GHC.Word.W#{d r1ujr}'),
The command that Cabal generated was this:
/usr/bin/ghc -package-name base-4.1.0.0 --make -hide-all-packages -i -idist/build -i. \
-idist/build/autogen -Idist/build/autogen -Idist/build -Iinclude -optP-include \
-optPdist/build/autogen/cabal_macros.h -#include "HsBase.h" -odir dist/build \
-hidir dist/build -stubdir dist/build -package ghc-prim-0.1.0.0 -package integer-0.1.0.1 \
-package rts-1.0 -O -package-name base -XMagicHash -XExistentialQuantification -XRank2Types \
-XScopedTypeVariables -XUnboxedTuples -XForeignFunctionInterface -XUnliftedFFITypes \
-XDeriveDataTypeable -XGeneralizedNewtypeDeriving -XFlexibleInstances -XStandaloneDeriving \
-XPatternGuards -XEmptyDataDecls -XCPP Foreign.Concurrent GHC.Arr GHC.Base GHC.Classes GHC.Conc \
GHC.ConsoleHandler GHC.Desugar GHC.Enum GHC.Environment GHC.Err GHC.Exception GHC.Exts GHC.Float \
GHC.ForeignPtr GHC.Handle GHC.IO GHC.IOBase GHC.Int GHC.List GHC.Num GHC.PArr GHC.Pack GHC.Ptr \
GHC.Read GHC.Real GHC.ST GHC.STRef GHC.Show GHC.Stable GHC.Storable GHC.TopHandler GHC.Unicode \
GHC.Weak GHC.Word System.Timeout Control.Applicative Control.Arrow Control.Category \
Control.Concurrent Control.Concurrent.Chan Control.Concurrent.MVar Control.Concurrent.QSem \
Control.Concurrent.QSemN Control.Concurrent.SampleVar Control.Exception Control.Exception.Base \
Control.OldException Control.Monad Control.Monad.Fix Control.Monad.Instances Control.Monad.ST \
Control.Monad.ST.Lazy Control.Monad.ST.Strict Data.Bits Data.Bool Data.Char Data.Complex \
Data.Dynamic Data.Either Data.Eq Data.Data Data.Fixed Data.Foldable Data.Function Data.HashTable \
Data.IORef Data.Int Data.Ix Data.List Data.Maybe Data.Monoid Data.Ord Data.Ratio Data.STRef \
Data.STRef.Lazy Data.STRef.Strict Data.String Data.Traversable Data.Tuple Data.Typeable \
Data.Unique Data.Version Data.Word Debug.Trace Foreign Foreign.C Foreign.C.Error \
Foreign.C.String Foreign.C.Types Foreign.ForeignPtr Foreign.Marshal Foreign.Marshal.Alloc \
Foreign.Marshal.Array Foreign.Marshal.Error Foreign.Marshal.Pool Foreign.Marshal.Utils \
Foreign.Ptr Foreign.StablePtr Foreign.Storable Numeric Prelude System.Console.GetOpt \
System.CPUTime System.Environment System.Exit System.IO System.IO.Error System.IO.Unsafe \
System.Info System.Mem System.Mem.StableName System.Mem.Weak System.Posix.Internals \
System.Posix.Types Text.ParserCombinators.ReadP Text.ParserCombinators.ReadPrec Text.Printf \
Text.Read Text.Read.Lex Text.Show Text.Show.Functions Unsafe.Coerce
I noticed that if I remove the -O from the command that cabal generated, and rebuild after cleaning and re-configuring, the problem goes away. However, if I clean, reconfigure and use the command that Cabal generated, I get the same build error.
This bug has been seen on x86 and x86_64 Linux installs.
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.4 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |