[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

notes to help with ghc6 armhf port



Hi!
   I see from ArmHardFloatTodo that ghc6 is waiting to be ported.  I
did this for armel and append the notes I made for my own benefit
while doing it, in case someone want to try this.

Cheers

    M

---------
Porting GHC to Debian armel

ghc6 cannot be autobuilt because it requires itself to build itself.

There are other haskell systems in Debian:
the nhc98 compiler and the hugs interpreter.

Versions in Debian:
nhc98 - only in sarge
ghc6 - etch:6.6-3 lenny/sid:6.6.1-2

There are two kinds of ghc ports:
- unregistered builds which are not optimised for the target CPU
- registered builds, which know about the registers available on the machine
  and some assembly language constructs so that the "Evil Mangler" script can
  edit the output assembly language giving a factor of two speed increase.

The current Debian arm port seems to be an "unregistered build",
i.e. a half-finished port that generates code that runs at half speed.

Strategy:

- Cross-compile a new unregistered build via intermediate .hc files,
  and install it under /usr/local

  The process is described in
  http://hackage.haskell.org/trac/ghc/wiki/Building/Porting
  See also
    http://www.haskell.org/pipermail/glasgow-haskell-users/2006-May/010164.html
  and replies

  - the GHC machine type arm-unknown-linux seems ok for arm-*-linux-gnueabi.

  - Once source tarball is unpacked:
        chmod 755 distrib/{hc-build,fake-happy}

  - at "make hc-file-bundle Project=ghc" on the host system it complains about
    missing files. Can fix all but one with:
    $ cd <H>/rts
    $ make AutoApply_thr_p.hc AutoApply_thr_debug.hc AutoApply_thr.hc
AutoApply_debug.hc
  - while building, two .hc files are missing:
    $ cd <H>/libraries/Cabal
    $ make cabal-setup/{CabalSetup,Setup}.hc
    $ cp -p !$ <T>/libraries/Cabal/cabal-setup/

  - On the target system, install all of ghc6's builddeps *except* xsltproc,
    because this is required for documentation only and makes a 64MB machine
    thrash.  Without it, the configure script just turns off building of
    documentation.

Problems building bootstrap compiler:

  - make -C libraries all:
        The build of cabal-setup fails because Setup.o is missing from the
        compile line. copy and paste and rerun that line.
  - make -C compiler all:
        gcc -x c parser/Parser.hc -o stage1/parser/Parser.o ...
        needs 121MB VM, unlikely to fit on a 128MB box with no swap.
        Removing -O doesn't help.
        Use a 247MB QEMU or enable some swap.

- build the debian ghc6 using the local compiler and with all builddeps except
  ghc6 installed (dpkg-buildpackage -rfakeroot -d)
  (dpkg-buildpackage -B gets you nowhere: all packages are arch-dependent)


Reply to: