RE: Porting GHC to powerpc-unknown-linux

Following Donald Stewart efforts and Simon Marlow's new porting guide, I made two attempts of getting GHC working on Linux/PowerPC.
I made a first attempt using cross-compiling from a Linux/i386 box. I followed every instruction on the guide, but the compiler was unusable, resulting in the following error message : hc-6.0.1: internal error: stg_ap_v_ret Please report this as a bug to glasgow-haskell-bugs@haskell.org, or http://www.sourceforge.net/projects/ghc/
Don got the same message for his cross-compilation tests, so I decided to stay on the same computer using the official build for Mac OS X.
I think the stg_ap_v_ret panic might be due to using the wrong AutoApply.hc, or some other mixup between registerised and unregisterised code. When I went through this bootstrap process recently I cross-compiled from a 32-bit machine to a 64-bit machine - in theory this should be the most difficult kind of port, but it went through surprisingly smoothly. Ok, so it was the same OS at both ends which might have made things easier. There's a small possibility that I've missed something out from the instructions, I suppose :)
I had to add -Onot -fvia-C to prelude/PrimOp_HC_OPTS in ghc/compiler/Makefile to make GHC build. This failed on the RTS as said in the guide, so I decided to go on. But I was unable to build the libraries. I got a bunch of error message like : "cpp0: unkown -smart flag", and it failed later at : /compiler/ghc-inplace -H16m -O -fglasgow-exts -cpp -Iinclude -#include HsBase.h -funbox-strict-fields -package-name base -O -H32m - -keep-hc-files -c GHC/Base.lhs -o GHC/Base.o -ohi GHC/Base.hi GHC/Base.hc:1111: only 1 arg to macro 'HP_CHK_NP' (2 expected) [...]
It looks like a mismatch between the header files in ghc/includes and the code the compiler is generating. Are you sure you're using *exactly* the same sources on both the host and the target machine? Cheers, Simon

simonmar:
There's a small possibility that I've missed something out from the instructions, I suppose :)
No. They are perfect. I've stress tested them today :p +-----------------+--------------------+----------------------------+ | HOST | TARGET | Unregisterised bootstrap | +-----------------+--------------------+----------------------------+ | i386-*-openbsd | i386-*-openbsd | YES | | | i386-*-freebsd | YES | | | i386-*-linux | YES | | | i386-*-solaris2 | YES | | | sparc-sun-solaris2 | YES | | | sparc-sun-openbsd | in-progress | | | m68k-apple-netbsd | in-progress | | | | | | | alpha-dec-osf3 | dies on host with: | | | | cc1: Invalid option `ieee' | +-----------------+--------------------+----------------------------+ So all 32-bit platforms have worked or are looking good, but the 64 bit couldn't get of the host machine. But I think we can see that GHC is portable now :) Cheers, Don
participants (2)
-
dons@cse.unsw.edu.au
-
Simon Marlow