[GHC] #13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC --------------------------------+---------------------------------------- Reporter: jms | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Keywords: | Operating System: Linux Architecture: powerpc | Type of failure: Building GHC failed Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------+---------------------------------------- We have a product based on a Freescale MPC8544E. I have previously built powerpc-unknown-linux-gnuspe-ghc-7.8.3 and that produces viable code though annoyingly rather large binaries but this is covered elsewhere. I looked at both 7.8.4 and 7.10 a while ago but they proved to be non- starters for reasons I no longer remember. Now for reasons tooling reasons (Stack and friends) it would be nice to use 8.0.2 My procedure is as follows In the (ghc-7.83 or) ghc-8.0.2 source directory base=powerpc-unknown-linux-gnuspe; ./configure --prefix=/tmp/prefix --target=$base --with-gcc=$base-gcc --with-ld=$base-ld --with-nm=$base-nm --with-ar=$base-ar --with-ranlib=$base-ranlib --enable-unregisterised I edit mk/build.mk to make flavour "quick-cross" I edit ghc.mk and comment out anything with haskeline or terminfo The bottom of settings says ("Unregisterised", "YES"), ("LLVM llc command", "/usr/bin/llc-3.7"), ("LLVM opt command", "/usr/bin/opt-3.7") But the make itself (on Ubuntu 16 amd64) fails. "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -O0 -H64m -Wall -this-unit-id ghc-prim-0.5.0.0 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -ilibraries /ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/dist- install/build -Ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries /ghc-prim/. -optP-include -optPlibraries/ghc-prim/dist- install/build/autogen/cabal_macros.h -package-id rts -this-unit-id ghc- prim -XHaskell2010 -O -fllvm -no-user-package-db -rtsopts -Wno- trustworthy-safe -Wno-deprecated-flags -Wnoncanonical-monad-instances -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim /dist-install/build -stubdir libraries/ghc-prim/dist-install/build -c libraries/ghc-prim/./GHC/Types.hs -o libraries/ghc-prim/dist- install/build/GHC/Types.o ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.0.2 for powerpc-unknown-linux): LlvmCodeGen.Ppr: Cross compiling without valid target info. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13495 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC ----------------------------------------+------------------------------- Reporter: jms | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------------+------------------------------- Changes (by bgamari): * cc: trommler, slyfox (added) * milestone: => 8.2.1 Comment: CCing the appropriate contributors. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13495#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC ----------------------------------------+------------------------------- Reporter: jms | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------------+------------------------------- Old description:
We have a product based on a Freescale MPC8544E.
I have previously built powerpc-unknown-linux-gnuspe-ghc-7.8.3 and that produces viable code though annoyingly rather large binaries but this is covered elsewhere.
I looked at both 7.8.4 and 7.10 a while ago but they proved to be non- starters for reasons I no longer remember.
Now for reasons tooling reasons (Stack and friends) it would be nice to use 8.0.2
My procedure is as follows
In the (ghc-7.83 or) ghc-8.0.2 source directory
base=powerpc-unknown-linux-gnuspe; ./configure --prefix=/tmp/prefix --target=$base --with-gcc=$base-gcc --with-ld=$base-ld --with-nm=$base-nm --with-ar=$base-ar --with-ranlib=$base-ranlib --enable-unregisterised
I edit mk/build.mk to make flavour "quick-cross"
I edit ghc.mk and comment out anything with haskeline or terminfo
The bottom of settings says ("Unregisterised", "YES"), ("LLVM llc command", "/usr/bin/llc-3.7"), ("LLVM opt command", "/usr/bin/opt-3.7")
But the make itself (on Ubuntu 16 amd64) fails.
"inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -O0 -H64m -Wall -this-unit-id ghc-prim-0.5.0.0 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim /dist-install/build -Ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/. -optP-include -optPlibraries/ghc-prim/dist- install/build/autogen/cabal_macros.h -package-id rts -this-unit-id ghc- prim -XHaskell2010 -O -fllvm -no-user-package-db -rtsopts -Wno- trustworthy-safe -Wno-deprecated-flags -Wnoncanonical-monad-instances -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim /dist-install/build -stubdir libraries/ghc-prim/dist-install/build -c libraries/ghc-prim/./GHC/Types.hs -o libraries/ghc-prim/dist- install/build/GHC/Types.o ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.0.2 for powerpc-unknown-linux): LlvmCodeGen.Ppr: Cross compiling without valid target info.
New description: We have a product based on a Freescale MPC8544E. I have previously built powerpc-unknown-linux-gnuspe-ghc-7.8.3 and that produces viable code though annoyingly rather large binaries but this is covered elsewhere. I looked at both 7.8.4 and 7.10 a while ago but they proved to be non- starters for reasons I no longer remember. Now for reasons tooling reasons (Stack and friends) it would be nice to use 8.0.2 My procedure is as follows In the (ghc-7.83 or) ghc-8.0.2 source directory {{{ base=powerpc-unknown-linux-gnuspe; ./configure --prefix=/tmp/prefix --target=$base --with-gcc=$base-gcc --with-ld=$base-ld --with-nm=$base-nm --with-ar=$base-ar --with-ranlib=$base-ranlib --enable-unregisterised }}} I edit mk/build.mk to make flavour "quick-cross" I edit ghc.mk and comment out anything with haskeline or terminfo The bottom of settings says ("Unregisterised", "YES"), ("LLVM llc command", "/usr/bin/llc-3.7"), ("LLVM opt command", "/usr/bin/opt-3.7") But the make itself (on Ubuntu 16 amd64) fails. {{{ "inplace/bin/ghc-stage1" -hisuf hi -osuf o -hcsuf hc -static -O0 -H64m -Wall -this-unit-id ghc-prim-0.5.0.0 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -ilibraries /ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/dist- install/build -Ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries /ghc-prim/. -optP-include -optPlibraries/ghc-prim/dist- install/build/autogen/cabal_macros.h -package-id rts -this-unit-id ghc- prim -XHaskell2010 -O -fllvm -no-user-package-db -rtsopts -Wno- trustworthy-safe -Wno-deprecated-flags -Wnoncanonical-monad-instances -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim /dist-install/build -stubdir libraries/ghc-prim/dist-install/build -c libraries/ghc-prim/./GHC/Types.hs -o libraries/ghc-prim/dist- install/build/GHC/Types.o ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.0.2 for powerpc-unknown-linux): LlvmCodeGen.Ppr: Cross compiling without valid target info. }}} -- Comment (by bgamari): Given that you are trying to build an unregisterised compiler, it's quite unclear to me how this `-fllvm` is sneaking into the command line. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13495#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC ----------------------------------------+------------------------------- Reporter: jms | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------------+------------------------------- Comment (by slyfox): '''quick-cross.mk''' explicitly enables '''llvm''' backend: {{{ GhcStage2HcOpts = -O0 -fllvm GhcLibHcOpts = -O -fllvm }}} You might want to disable that as you are using '''--enable- unregisterised'''. I think '''GHC''' should ignore '''-fllvm''' (with a warning) if compiler targets unregisterised codegen. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13495#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC ----------------------------------------+------------------------------- Reporter: jms | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------------+------------------------------- Comment (by jms): You are both right. I have removed the -fllvm options, made and the result seems to work as well as 7.8.3 anyway. Thank you very much for your quick response and please close this ticket. Jon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13495#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC ----------------------------------------+------------------------------- Reporter: jms | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: powerpc Type of failure: Building GHC failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------------+------------------------------- Comment (by rwbarton): Let's keep this open as it pointed out that GHC fails to ignore `-fllvm` in an unregisterized compiler. I don't have time to fix this right now but it looks like we just need to check for `HscLlvm` as well in this snippet near the end of `DynFlags`: {{{#!hs | hscTarget dflags == HscAsm && platformUnregisterised (targetPlatform dflags) = loop (dflags { hscTarget = HscC }) "Compiler unregisterised, so compiling via C" }}} (Maybe it would even be better to merge the targets `HscAsm` and `HscLlvm`, since they are equivalent for most purposes besides actually building the build pipeline?) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13495#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for
PPC
----------------------------------------+-------------------------------
Reporter: jms | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 8.0.2
Resolution: | Keywords:
Operating System: Linux | Architecture: powerpc
Type of failure: Building GHC failed | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
----------------------------------------+-------------------------------
Comment (by Sergei Trofimovich

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC -------------------------------------+------------------------------------- Reporter: jms | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: Type of failure: Building GHC | Unknown/Multiple failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by slyfox): * status: new => merge * architecture: powerpc => Unknown/Multiple Comment: I've tested 'quick-cross' on powerpc-linux-gnuspe target. Works with the patch above. Should be harmless to backport to 8.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13495#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for PPC -------------------------------------+------------------------------------- Reporter: jms | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: Type of failure: Building GHC | Unknown/Multiple failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged as 70530b42c41d97a8accd3e8565b4fa31ca80b5d6. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13495#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13495: ghc-stage1: panic! (the 'impossible' happened) creating cross compiler for
PPC
-------------------------------------+-------------------------------------
Reporter: jms | Owner: (none)
Type: bug | Status: closed
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 8.0.2
Resolution: fixed | Keywords:
Operating System: Linux | Architecture:
Type of failure: Building GHC | Unknown/Multiple
failed | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Sergei Trofimovich
participants (1)
-
GHC