Porting GHC to powerpc-unknown-linux

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, 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 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) [...] I don't know what to try next... Lunar. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (Darwin) iD8DBQE/VnHBd1rcjNWgdWQRAsuOAKCGE0Gh1FQrEAO5Xxt5cV11HioeqwCggtIw 9raJSSCz1i2dtduDNY9pgco= =pj8F -----END PGP SIGNATURE-----

lunar:
Hello,
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 did something very slightly incorrect, I think, though I don't know what it was, because I got a working cross-port to freebsd yesterday, on a box that had previously given me the stg_ap_v_ret error. See yesterday's post of mine on that. The i386-*-linux host is probably the best host, because of header etc. compatibility. I always got a lot more pain when the OS's were very different.
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) [...]
I don't know what to try next...
Try (or look at) the new hc-build script from cvs, Simon updated that last night. Also, see if there is anything in the building guide you might have done slightly differently, as the build system is very fragile. -- Don

dons:
lunar:
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/
Try (or look at) the new hc-build script from cvs, Simon updated that last night.
Also, see if there is anything in the building guide you might have done slightly differently, as the build system is very fragile.
There is a copy of the building guide, built from last night's cvs here, for people who want to use the new instructions: http://www.cse.unsw.edu.au/~dons/building/sec-porting-ghc.html -- Don

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 04 September 2003 01:45, Donald Bruce Stewart wrote:
I did something very slightly incorrect, I think, though I don't know what it was, because I got a working cross-port to freebsd yesterday, on a box that had previously given me the stg_ap_v_ret error. See yesterday's post of mine on that.
Ok, I made another try today, here is the detailed report :
lunar@moon:~$ uname -a
Linux moon 2.4.22-ben1 #1 Wed Aug 27 13:00:30 CEST 2003 ppc GNU/Linux
lunar@moon:~$ wget http://www.haskell.org/ghc/dist/6.0.1/ghc-6.0.1-src.tar.bz2
lunar@moon:~$ md5sum ghc-6.0.1-src.tar.bz2
6e258de758b34905ecfc636a38fa9e23 ghc-6.0.1-src.tar.bz2
lunar@moon:~$ tar jxf ghc-6.0.1-src.tar.bz2
lunar@moon:~/ghc-6.0.1$ vim configure.in
- ---
Adding this at line 294
powerpc-unknown-linux*)
HostPlatform=powerpc-unknown-linux
TargetPlatform=powerpc-unknown-linux
BuildPlatform=powerpc-unknown-linux
HostPlatform_CPP='powerpc_unknown_linux'
HostArch_CPP='powerpc'
HostVendor_CPP='unknown'
HostOS_CPP='linux'
;;
- ---
lunar@moon:~/ghc-6.0.1$ autoreconf2.50
lunar@moon:~/ghc-6.0.1$ ./configure --enable-hc-boot --enable-unregisterised
lunar@moon:~/ghc-6.0.1$ cd ghc/includes/
lunar@moon:~/ghc-6.0.1/ghc/includes$ make config.h
lunar@reglisse:~$ uname -a
Linux reglisse 2.4.18-686-smp #1 SMP Sun Apr 14 12:07:19 EST 2002 i686 unknown
lunar@reglisse:~$ wget
http://www.haskell.org/ghc/dist/6.0.1/ghc-6.0.1-src.tar.bz2
lunar@reglisse:~$ md5sum ghc-6.0.1-src.tar.bz2
6e258de758b34905ecfc636a38fa9e23 ghc-6.0.1-src.tar.bz2
lunar@reglisse:~$ tar jxf ghc-6.0.1-src.tar.bz2
lunar@reglisse:~/ghc-6.0.1$ ./configure
lunar@reglisse:~/ghc-6.0.1$ vim mk/build.mk
lunar@moon:~/ghc-6.0.1/ghc/includes$ scp config.h
lunar@reglisse:ghc-6.0.1/ghc/includes
lunar@reglisse:~/ghc-6.0.1$ vim mk/config.mk
- ---
TARGETPLATFORM = powerpc-unknown-linux
LeadingUnderscore=NO
- ---
lunar@reglisse:~/ghc-6.0.1$ vim libraries/mk/boilerplate.mk
lunar@reglisse:~/ghc-6.0.1$ vim hslibs/mk/boilerplate.mk
- ---
Add Ian's AR, LD and SRC_HC_OPTS hack.
- ---
lunar@reglisse:~/ghc-6.0.1$ (cd glafp-utils && make boot && make)
lunar@reglisse:~/ghc-6.0.1$ (cd ghc && make boot && make)
lunar@reglisse:~/ghc-6.0.1$ (cd libraries && make boot && make)
lunar@reglisse:~/ghc-6.0.1$ vim ghc/mk/boilerplate.mk
- --- Still adding Ian's hack
lunar@reglisse:~/ghc-6.0.1$ (cd ghc && make boot stage=2 && make stage=2)
lunar@reglisse:~/ghc-6.0.1/ghc/utils$ make clean
lunar@reglisse:~/ghc-6.0.1/ghc/utils$ make -k
HC=~/ghc-6.0.1/ghc/compiler/stage1/ghc-inplace EXTRA_HC_OPTS='-O -fvia-C
- -keep-hc-files'
lunar@reglisse: ~/ghc-6.0.1$ make hc-file-bundle Project=Ghc
lunar@moon:~/ghc-6.0.1/distrib$ wget -O hc-build
http://cvs.haskell.org/cgi-bin/cvsweb.cgi/~checkout~/fptools/distrib/hc-buil...
lunar@moon:~$ scp
lunar@reglisse:ghc-6.0.1/ghc-6.0.1-powerpc-unknown-linux-hc.tar.gz .
lunar@moon:~$ tar zxf ghc-6.0.1-powerpc-unknown-linux-hc.tar.gz
lunar@moon:~/ghc-6.0.1$ ./distrib/hc-build --enable-hc-boot-unregisterised
[...]
../../ghc/utils/ghc-pkg/ghc-pkg-inplace --update-package
participants (2)
-
dons@cse.unsw.edu.au
-
Lunar