Opened 3 years ago

Last modified 3 years ago

#64698 assigned enhancement

approach to fix Haskell (GHC) for PowerPC: some initial progress — at Initial Version

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: powerpc, leopard, snowleopard Cc:
Port: ghc, ghc-bootstrap

Description

I want to bring GHC to PowerPC systems. So far I was able to bootstrap ghc 7.0.1 using ghc-bootstrap port file as a draft and substituting ppc distributive:

36-47% port -v installed ghc-bootstrap
The following ports are currently installed:
  ghc-bootstrap @7.0.1_0 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-19T12:58:35+0800'

Building ghc 7.8.x requires at least ghc 7.4.x, and Macports now uses ghc 7.6.2 as a bootstrap compiler. The latter is impossible for ppc as of now, unless we want to make our own distributive to that end. However it seems that ghc 7.6.x can be built with bootstrapped ghc 7.0.1 and Macports gcc. A first attempt fails on Stage 2 with haddock:

:info:build "rm" -f                              inplace/bin/haddock  
:info:build echo '#!/bin/sh'                             >> inplace/bin/haddock
:info:build echo 'executablename="/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_ghc/ghc/work/ghc-7.6.3/inplace/lib/haddock"'            >> inplace/bin/haddock
:info:build echo 'datadir="/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_ghc/ghc/work/ghc-7.6.3/inplace/lib"'       >> inplace/bin/haddock
:info:build echo 'bindir="/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_ghc/ghc/work/ghc-7.6.3/inplace/bin"'        >> inplace/bin/haddock
:info:build echo 'topdir="/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_ghc/ghc/work/ghc-7.6.3/inplace/lib"'     >> inplace/bin/haddock
:info:build echo 'pgmgcc="/opt/local/bin/gcc-mp-7"'            >> inplace/bin/haddock
:info:build cat utils/haddock/haddock.wrapper               >> inplace/bin/haddock
:info:build chmod +x                               inplace/bin/haddock
:info:build "inplace/bin/mkdirhier" libraries/ghc-prim/dist-install/doc/html/ghc-prim//.
:info:build "inplace/bin/mkdirhier" libraries/ghc-prim/dist-install/build/autogen/GHC//.
:info:build "inplace/bin/genprimopcode" --make-haskell-source < compiler/prelude/primops.txt > libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs
:info:build "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_ghc/ghc/work/ghc-7.6.3/inplace/bin/haddock" --odir="libraries/ghc-prim/dist-install/doc/html/ghc-prim" --no-tmp-comp-dir --dump-interface=libraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock --html --hoogle --title="ghc-prim-0.3.0.0: GHC primitives" --prologue="libraries/ghc-prim/dist-install/haddock-prologue.txt"   --optghc=-H32m --optghc=-O --optghc=-package-name --optghc=ghc-prim-0.3.0.0 --optghc=-hide-all-packages --optghc=-i --optghc=-ilibraries/ghc-prim/. --optghc=-ilibraries/ghc-prim/dist-install/build --optghc=-ilibraries/ghc-prim/dist-install/build/autogen --optghc=-Ilibraries/ghc-prim/dist-install/build --optghc=-Ilibraries/ghc-prim/dist-install/build/autogen --optghc=-Ilibraries/ghc-prim/. --optghc=-optP-include --optghc=-optPlibraries/ghc-prim/dist-install/build/autogen/cabal_macros.h --optghc=-package --optghc=rts-1.0 --optghc=-split-objs --optghc=-package-name --optghc=ghc-prim --optghc=-XHaskell98 --optghc=-XCPP --optghc=-XMagicHash --optghc=-XForeignFunctionInterface --optghc=-XUnliftedFFITypes --optghc=-XUnboxedTuples --optghc=-XEmptyDataDecls --optghc=-XNoImplicitPrelude --optghc=-O2 --optghc=-no-user-package-db --optghc=-rtsopts --optghc=-odir --optghc=libraries/ghc-prim/dist-install/build --optghc=-hidir --optghc=libraries/ghc-prim/dist-install/build --optghc=-stubdir --optghc=libraries/ghc-prim/dist-install/build --optghc=-hisuf --optghc=hi --optghc=-osuf --optghc=o --optghc=-hcsuf --optghc=hc    libraries/ghc-prim/./GHC/Classes.hs  libraries/ghc-prim/./GHC/CString.hs  libraries/ghc-prim/./GHC/Debug.hs  libraries/ghc-prim/./GHC/Magic.hs  libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs  libraries/ghc-prim/./GHC/IntWord64.hs  libraries/ghc-prim/./GHC/Tuple.hs  libraries/ghc-prim/./GHC/Types.hs libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs +RTS -tlibraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock.t --machine-readable
:info:build haddock: internal error: evacuate(static): strange closure type 18699
:info:build     (GHC version 7.6.3 for powerpc_apple_darwin)
:info:build     Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
:info:build make[1]: *** [libraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock] Abort trap
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_ghc/ghc/work/ghc-7.6.3'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_ghc/ghc/work/ghc-7.6.3" && /usr/bin/make -j1 -w all 
:info:build Exit code: 2
:error:build Failed to build ghc: command execution failed
:debug:build Error code: CHILDSTATUS 91677 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"

I am trying to build it again with docs disabled now. Given how far it went it looks feasible. If it works eventually, we gonna have ghc 7.6.3 on PowerPC.

Technical question arises: how to arrange two-step bootstrap? That is, bootstrap 7.0.1, build 7.6.3 with it and use the latter to build something new. In other words, PowerPC needs a pre-bootstrap stage, assuming existing port ghc-bootstrap.

Change History (1)

Changed 3 years ago by barracuda156

Attachment: main.log added
Note: See TracTickets for help on using tickets.