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

Partial bootstrapping guide for ghc



Hello!

I have been busy almost the whole evening yesterday to bootstrap ghc on
Debian sh4 yesterday. I successfully cross-compiled ghc for sh4 and
installed a mini ghc distribution into my sh4 sbuild chroot. I still
have some minor issues with the ghc package database so that I cannot
build the Debian ghc package for sh4 yet, but otherwise, ghc on sh4
is fully working.

Thus, if anyone wants to get their hands at bootstrapping ghc for
sparc64 - which I would highly appreciate - here's what you need
to do to get a stage2 (a native) compiler for sparc64:

1. Install ghc on your amd64 build machine and its build
   dependencies:

   $ apt-get install ghc && apt-get build-dep ghc

2. Install the sparc64 gcc cross toolchain:

   $ apt-get install gcc-sparc64-linux-gnu

3. Download the right version of ghc from Debian:

   $ wget
http://snapshot.debian.org/archive/debian/20151203T214229Z/pool/main/g/ghc/ghc_7.10.3.orig.tar.xz

4. Unpack the source tarball:

   $ tar xf ghc_7.10.3.orig.tar.xz

5. Apply this patch: https://phabricator.haskell.org/D1430

6. Run configure with sparc64-linux-gnu as TARGET:

   $ ./configure --enable-unregisterised --target=sparc64-linux-gnu
--with-curses-libraries=/usr/lib/sparc64-linux-gnu
--with-curses-includes=/usr/include
--with-gmp-libraries=/usr/lib/sparc64-linux-gnu
--with-gmp-includes=/usr/sparc64-linux-gnu/include

7. Edit ghc's build configuration to build ghc's BuildFlavour
   "quick-cross" only.

   $ cp mk/build.mk.sample mk/build.mk

   and uncomment "BuildFlavour  = quick-cross"

   In the same file, check that in the section for "quick-cross"
   further below, you remove "-fllvm" everywhere.

   Here you can also control with ("stage=1" or "stage=2") whether
   you want to build just stage1 or right away stage2 the latter
   requiring to move the code over onto a native sparc64 to
   continue the build at some point.

8. Run "make".

Let me know about your results. This guide is still incomplete
but if everything goes well, you should end up with a minimal
stage1 and/or stage2 compiler respectively.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913


Reply to: