
Hi Don,
Here is a (long) summary of how I have bootstraped GHC on various os/arch combinations using 6.0.1 .hc source, including getting an unregisterised build, over the weekend.
Thanks for all this. I recently went through the unregisterised bootstrap process myself (for amd64), and I've written some detailed instructions in the Building Guide - you might want to take a look and see if you have anything to add. For unregisterised bootstrapping, I don't recommend using hc-build. The resaon is that hc-build goes to some lengths to make a tree which is safe to 'make install' in, and this isn't necessary for bootstrapping - all you need to do is get to the "working compiler" stage, and then use this to build a completely fresh tree. I've applied your patches, with some small tweaks by myself to avoid breaking the unregisterised bootstrap, which is normally done with a compiler without interpreter support, hence the lack of the readline, haskell-src and other libraries. Cheers, Simon

simonmar:
Thanks for all this. I recently went through the unregisterised bootstrap process myself (for amd64), and I've written some detailed instructions in the Building Guide - you might want to take a look and see if you have anything to add.
I've been working from that document the last few days. See below.
I've applied your patches, with some small tweaks by myself to avoid breaking the unregisterised bootstrap, which is normally done with a
Thanks.
compiler without interpreter support, hence the lack of the readline, haskell-src and other libraries.
Ah! Of course. That is what's going on. I continued my 6.0.1 unregisterised bootstrapping efforts following the latest version of building/building.sgml. The steps therein are successful, and I have nothing to add at this point. Unregisterised, the news is a bit frustrating. Of the cross-port machines that went through successfully (3 of 5), none produced a working compiler. They all resulted in: ghc-6.0.1: internal error: stg_ap_v_ret Please report this as a bug to glasgow-haskell-bugs@haskell.org, However, I have been entirely successfully generating registerised and unregisterised hc on x86-{linux,openbsd} and then bootstrapping on the same platform: this is how the i386 GHC 6.0.1 port in the OpenBSD ports tree now bootstraps (from nothing to full Haskell in 31 minutes on my work box :) The furthest I've made it cross-porting, using a variety of paths in, has been the stg_ap_v_ret bug above. I haven't looked into this further, but will do so in weeks to come. I thought it might be useful to report these results, though. Cheers, Don Below is a list of machines I attempted to port from and to, and any bugs fixed along the way. All host machines had a full installation of GHC 6.0.1. The ports at listed in "$Target from $Host" pairs by their canonical name. -------------------------------------------------------------- [1] sparc-unknown-openbsd from i386-unknown-openbsd -------------------------------------------------------------- Host: 1. gmake -k ..etc caused errors. Unresolved as whether this is bad or not: undefined reference to `GHCziWeak_runFinalizzerBatch_closure' Target: 2. PrimOp.hc dies unless -O is turned off in the gcc flags: Looks like a gcc bug. gcc -x c prelude/PrimOp.hc -o stage1/prelude/PrimOp.o -c -O -w -DNO_REGS -DUSE_MINIINTERPRETER -D__GLASGOW_HASKELL__=600 -O -DNO_REGS -DUSE_MINIINTERPRETER -I/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/ghc/includes -I/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/libraries/base/include -I/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/libraries/unix/include -I/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/libraries/readline/include -Iparser -I. -O -D__GLASGOW_HASKELL__=600 -I. `echo | sed 's/^$/-DSTOLEN_X86_REGS=4/'` prelude/PrimOp.hc: In function `skkX_ret': prelude/PrimOp.hc:58811: virtual memory exhausted gmake[1]: *** [stage1/prelude/PrimOp.o] Error 1 gmake: *** [all] Error 1 gmake: Leaving directory `/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/ghc' 4682.23s real 3440.07s user 873.16s system 3. Everything then goes through fine, producing a binary that dies: $ /usr/obj/ports/ghc-6.0.1/ghc-6.0.1/ghc/compiler/ghc-inplace -v ghc-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/ -------------------------------------------------------------- [2] sparc-unknown-openbsd <- i386-unknown-linux -------------------------------------------------------------- Host: 1. On linking GHC: solution (generate .hc files without SIGPOLL), same as [4].1, so comment out SIGPOLL in mk/config.h Target: This was a problem using Linux as a host machine in general, otherwise you get: l98 -lHSbase -lHSbase_cbits -lHSrts -lgmp -lm -lreadline -lncurses /usr/obj/ports/ghc-6.0.1/ghc-6.0.1/libraries/base/libHSbase.a(Signals.o): In function `SystemziPosixziSignals_sigPOLL_entry': Signals.o(.text+0x4c6c): undefined reference to `__hsposix_SIGPOLL' collect2: ld returned 1 exit status gmake[1]: *** [stage1/ghc-6.0.1] Error 1 gmake: *** [all] Error 1 gmake: Leaving directory `/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/ghc' 2. gcc complains without turning -O off on PrimOp.hc, same as [1].3. So compile without -O for this file: gcc -x c prelude/PrimOp.hc -o stage1/prelude/PrimOp.o -c -O -w -DNO_REGS -DUSE_MINIINTERPRETER -D__GLASGOW_HASKELL__=600 -O -DNO_REGS -DUSE_MINIINTERPRETER -I/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/ghc/includes -I/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/libraries/base/include -I/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/libraries/unix/include -Iparser -I. -O -D__GLASGOW_HASKELL__=600 -I. `echo | sed 's/^$/-DSTOLEN_X86_REGS=4/'` prelude/PrimOp.hc: In function `skkX_ret': prelude/PrimOp.hc:58811: virtual memory exhausted gmake[1]: *** [stage1/prelude/PrimOp.o] Error 1 gmake: *** [all] Error 1 gmake: Leaving directory `/usr/obj/ports/ghc-6.0.1/ghc-6.0.1/ghc' 3. Goes through to the end without problems: $ ghc/compiler/ghc-inplace ghc-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/ -------------------------------------------------------------- [3] i386-unknown-freebsd <- i386-unknown-openbsd -------------------------------------------------------------- Host: no changes! Target: 1. Went through cleanly generating a compiler that dies with: % ghc/compiler/ghc-inplace ghc-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/ This is the same bug I've been unable to resolve in ports [1,2] -------------------------------------------------------------- [4] i386-unknown-freebsd <- i386-unknown-linux -------------------------------------------------------------- Host: 1. Linking ghc on the target will fail because SIGPOLL (same as above) is defined on linux, not on *BSD, so turn it off in the generation of unreg .hc files in the first place. Target: 3. System/Sendfile.hc: In function `sae6_ret': System/Sendfile.hc:526: warning: passing arg 3 of `sendfile' makes integer from pointer without a cast System/Sendfile.hc:526: too few arguments to function `sendfile' gmake[1]: *** [System/Sendfile.o] Error 1 gmake: *** [all] Error 1 gmake: Leaving directory `/usr/home/dons/ghc/ghc-6.0.1/libraries' Haven't gone further with this. -------------------------------------------------------------- [5] m68k-unknown-netbsd <- i386-unknown-linux -------------------------------------------------------------- Host: 1. comment out SIGPOLL in mk/config.h Target: Made it through the libraries, haven't come back to this yet.

dons:
simonmar:
Thanks for all this. I recently went through the unregisterised bootstrap process myself (for amd64), and I've written some detailed instructions in the Building Guide - you might want to take a look and see if you have anything to add.
-------------------------------------------------------------- [3] i386-unknown-freebsd <- i386-unknown-openbsd --------------------------------------------------------------
Host: no changes!
Target: 1. Went through cleanly generating a compiler that dies with:
% ghc/compiler/ghc-inplace ghc-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/
This is the same bug I've been unable to resolve in ports [1,2]
Ok!! I just bootstrapped 6.0.1 on i386-*-freebsd using unregisterised .hc source from i386-*-openbsd. I carefully did exactly what was in building.sgml, (which I had tried to before but I must then have been doing something systematically wrong :( Anyway, this gives me some confidence that all the failed ports were a systematic error on my part, not GHC's :D $ uname -msr FreeBSD 5.0-RELEASE i386 $ ghc/ghc-6.0.1/ghc/compiler/ghc-inplace ghc-6.0.1: no input files Usage: For basic information, try the `--help' option. $ ghc/ghc-6.0.1/ghc/compiler/ghc-inplace hello.hs hello.hs:1: Failed to load interface for `Prelude': Could not find interface file for `Prelude' (use -v to see a list of the files searched for) I'll solve this library thing, try and build a compiler. And then try a sparc. Cheers, Don

On Wed, Sep 03, 2003 at 12:39:33PM +1000, Donald Bruce Stewart wrote:
$ ghc/ghc-6.0.1/ghc/compiler/ghc-inplace ghc-6.0.1: no input files Usage: For basic information, try the `--help' option.
$ ghc/ghc-6.0.1/ghc/compiler/ghc-inplace hello.hs hello.hs:1: Failed to load interface for `Prelude': Could not find interface file for `Prelude' (use -v to see a list of the files searched for)
I'll solve this library thing, try and build a compiler. And then try a sparc.
I have found that I need to copy the library/ .hi files across, although Simon Marlow seemed to think that should be unnecessary. Also, ghc/driver/package.conf.inplace seems to become the empty list; I haven't bothered to look into this as it's easy enough just to copy ghc/driver/package.conf.inplace.old over the top of it. This isn't following the new docs online so YMMV. Thanks Ian

igloo:
On Wed, Sep 03, 2003 at 12:39:33PM +1000, Donald Bruce Stewart wrote:
$ ghc/ghc-6.0.1/ghc/compiler/ghc-inplace ghc-6.0.1: no input files Usage: For basic information, try the `--help' option.
$ ghc/ghc-6.0.1/ghc/compiler/ghc-inplace hello.hs hello.hs:1: Failed to load interface for `Prelude': Could not find interface file for `Prelude' (use -v to see a list of the files searched for)
I'll solve this library thing, try and build a compiler. And then try a sparc.
I have found that I need to copy the library/ .hi files across, although Simon Marlow seemed to think that should be unnecessary. Also, ghc/driver/package.conf.inplace seems to become the empty list; I haven't bothered to look into this as it's easy enough just to copy ghc/driver/package.conf.inplace.old over the top of it. This isn't following the new docs online so YMMV.
Exactly! I tarred up the libraries/ .hi files on the host box: $ find libraries -name '*.hi' -print > /tmp/f $ tar czf ghc-6.0.1-hi.tar.gz `cat /tmp/f` copied them across, and untarred over the tree. Also needed the package.conf.in tweak. And I had to turn off "dl" in the extra_libraries list of package.co.inplace (for FreeBSD). Yay! A pretty straightforward cross-os bootstrap, from i386-*-openbsd to i386-*-freebsd: $ cat hello.hs import System.Info main = print System.Info.arch >> print System.Info.os $ ghc/ghc-6.0.1/ghc/compiler/ghc-inplace --numeric-version 6.0.1 $ ghc/ghc-6.0.1/ghc/compiler/ghc-inplace hello.hs $ % ./a.out "i386" "freebsd" I'll try a cross-processor port now. Cheers, Don
participants (3)
-
dons@cse.unsw.edu.au
-
Ian Lynagh
-
Simon Marlow