Porting ghc by cross-compiling

Svante Signell svante.signell at telia.com
Thu Feb 2 15:29:41 CET 2012


Hi,

I'm working on porting ghc, currently ghc-6.12.3, to GNU/Hurd which is
i{3,4,5,6}86. I've followed the instructions at 

http://hackage.haskell.org/trac/ghc/wiki/Building/Porting

The main reason for trying this is that we are stuck at ghc6.6. 6.6
builds 6.8 but 6.8 cannot be used to build 6.8 itself. I've tried
building 6.10 with 6.8 for some time now but I am giving up on that :-(
6.6 to 6.10 is not possible, at least not in Debian?

Ticket #3472 says that cross-building is broken: Which versions do this
apply to: all 6.x, all 7.x?
 
In order to get going with 5.12.3 I had to patch aclocal.m4 and
libraries/base/aclocal.m4. That information was found on the web, no
problem.

First I tried using an x86_64 box as host but that created problems due
to conflicting definitions of registers in: includes/stg/MachRegs.h. So
that build failed. not even make -k succeeded.

Then I used an i686 box as host an that one worked to create the .hc
files for the target build. After adding -Ilibraries/base/include and
-Ilibraries/unix/include I was able to manually build 
libraries/process/dist-install/build/cbits/runProcess.o
after that the build was smooth :)
(BTW: Where to add these includes to compile runProcess.c without manual
intervention?)

Then the build continues and stage2-ghc is built. inplace/bin/ghc-pkg
failed as pointed out on the web page (What is it used for?)

However, the resulting binary Segfaults when trying to run it. gdb
showed that the segfault comes from 

#0  0x0b1949ba in stg_enter_info ()
#1  0x0a5a8aa3 in StgRun (f=0xb1949b8 <stg_enter_info>,
basereg=0xb19694c)
    at rts/StgCRun.c:95

which leads to:

 rtc/HeapStackCheck.hc
/* GHC_PACKAGES base integer-gmp ghc-prim rts ffi-1.0
*/
#include "Stg.h"
StgWord stg_enter_info[] = {
0x1U, 0x22U
};

A few questions arise from the above:
1) Can I disable the build of the integer-gmp library?
  It looks like the segfault is caused by it, maybe I'm wrong?
2) In StGCRun.c the crashing code run is enabled if USE_MINIINTERPRETER
is defined. How to control that define?
3) Cross-compiling is also mentioned on the web pages, but no detailed
information on how to do this is available. Hints/links, etc?

Any help regarding this is very much appreciated.

Thanks!




More information about the Cvs-ghc mailing list