Opened 19 months ago

Last modified 3 months ago

#7490 new bug

ghc-stage1 panic when building a cross-compiler or cross-building a compiler

Reported by: singpolyma Owned by:
Priority: normal Milestone: 7.10.1
Component: Compiler Version: 7.7
Keywords: cross-compilation Cc: pho@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Building GHC failed Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo)

"inplace/bin/ghc-stage1" -static  -H64m -O0 -fasm    -package-name integer-simple-0.1.1.0 -hide-all-packages -i -ilibraries/integer-simple/. -ilibraries/integer-simple/dist-install/build -ilibraries/integer-simple/dist-install/build/autogen -Ilibraries/integer-simple/dist-install/build -Ilibraries/integer-simple/dist-install/build/autogen -Ilibraries/integer-simple/.    -optP-include -optPlibraries/integer-simple/dist-install/build/autogen/cabal_macros.h -package ghc-prim-0.3.1.0  -package-name integer-simple -Wall -XHaskell98 -XCPP -XMagicHash -XBangPatterns -XUnboxedTuples -XForeignFunctionInterface -XUnliftedFFITypes -XNoImplicitPrelude -O -fasm  -no-user-package-db -rtsopts      -odir libraries/integer-simple/dist-install/build -hidir libraries/integer-simple/dist-install/build -stubdir libraries/integer-simple/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c libraries/integer-simple/./GHC/Integer/Type.hs -o libraries/integer-simple/dist-install/build/GHC/Integer/Type.o
ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 7.7.20121205 for i386-unknown-nto-qnx):
	expectJust initTcInteractive

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

make[1]: *** [libraries/integer-simple/dist-install/build/GHC/Integer/Type.o] Error 1
make: *** [all] Error 2

Change History (10)

comment:1 Changed 19 months ago by singpolyma

Running make a second time gets past this step, so it is not deterministic.

comment:2 Changed 19 months ago by singpolyma

I just ran into this again. As far as I can tell it *always* happens on the first attempt to build GHC, and then does not recur if you just type make again.

comment:3 Changed 19 months ago by PHO

  • Cc pho@… added

comment:4 Changed 19 months ago by PHO

  • Architecture changed from x86 to Unknown/Multiple
  • Keywords cross-compilation added; qnx removed
  • Operating System changed from Other to Unknown/Multiple
  • Summary changed from ghc-stage1 panic when building QNXNTO cross-compiler to ghc-stage1 panic when building a cross-compiler or cross-building a compiler

This happens to me too while cross-building a compiler for NetBSD/amd64, so this isn't specific to QNXNTO:

ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 7.7.20121224 for x86_64-unknown-netbsd):
        expectJust initTcInteractive

comment:5 Changed 18 months ago by simonmar

  • Difficulty set to Unknown
  • Milestone set to 7.8.1
  • Priority changed from normal to high

Confirmed; I just saw this when building a cross-compiler for Raspberry Pi.

comment:6 Changed 18 months ago by simonmar

A bit more info, after I elaborated the panic:

"inplace/bin/ghc-stage1" -static  -H64m -O0    -package-name integer-simple-0.1.1.0 -hide-all-packages -i -ilibraries/integer-simple/. -ilibraries/integer-simple/dist-install/build -ilibraries/integer-simple/dist-install/build/autogen -Ilibraries/integer-simple/dist-install/build -Ilibraries/integer-simple/dist-install/build/autogen -Ilibraries/integer-simple/.    -optP-include -optPlibraries/integer-simple/dist-install/build/autogen/cabal_macros.h -package ghc-prim-0.3.1.0  -package-name integer-simple -Wall -XHaskell98 -XCPP -XMagicHash -XBangPatterns -XUnboxedTuples -XForeignFunctionInterface -XUnliftedFFITypes -XNoImplicitPrelude -O  -no-user-package-db -rtsopts      -odir libraries/integer-simple/dist-install/build -hidir libraries/integer-simple/dist-install/build -stubdir libraries/integer-simple/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c libraries/integer-simple/./GHC/Integer/Type.hs -o libraries/integer-simple/dist-install/build/GHC/Integer/Type.o

Top level:
    Bad interface file: libraries/integer-simple/dist-install/build/GHC/Integer/Type.hi
        libraries/integer-simple/dist-install/build/GHC/Integer/Type.hi: openBinaryFile: does not exist (No such file or directory)
ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 7.7.20130116 for arm-unknown-linux):
        initTcForLookup

So we're trying to read Type.hi while compiling the same module. This explains why it works the second time, after Type.hi has already been generated.

comment:7 Changed 18 months ago by simonmar

  • Owner set to igloo

I expect this will reproduce in an ordinary compilation, using INTEGER_LIBRARY = integer-simple. Ian, would you like to take a look? I'm pretty sure it's related to the lookup of mkInteger in CorePrep. Maybe GHC.Integer.Type itself has an integer in it?

comment:8 Changed 18 months ago by igloo

  • Description modified (diff)

comment:9 Changed 12 months ago by igloo

  • Owner igloo deleted

comment:10 Changed 3 months ago by thoughtpolice

  • Milestone changed from 7.8.3 to 7.10.1
  • Priority changed from high to normal
Note: See TracTickets for help on using tickets.