Porting to NetBSD Alpha (alpha-unknown-netbsd)

Svend Sorensen ssorensen at gmail.com
Sat Dec 18 01:30:55 EST 2004

I am working on porting ghc-6.2.2 to NetBSD Alpha according to the
porting instructions (10.2. Porting GHC to a new architecture) in the
Building Guide.

The target system is NetBSD 1.6.2 (STABLE)  alpha, and the host system
is a Red Hat 9.0 i386 system with the ghc-6.2.2 base and profiling
RPMs installed.  All example diff files, hc tarball, etc. (see ...)
are at http://sorensen.freeshell.org/ghc/ for now.

Target System

I added alpha-unknown-netbsd to T/configure.ac (see configure.ac.diff)
and ran autoreconf.  The instructions 'make config.h' didn't work with
NetBSD's make; gmake was required.  I then copied the config.h (see
config.h) to the host system.

Host System

While running make in H/libraries, I ran into the "cc1: Invalid option
`ieee'" discussed on the mailing list:

I used Ian's suggested mk/boilerplate.mk fix:
This fixed most of the errors, but 'ar' still ran a few times, causing
an error.  Running 'make AR=/bin/true LD=/bin/true' fixed these (I was
unable to track down where these problematic make lines were).  I then
build the hc file tarball (see
ghc-6.2.2-alpha-unknown-netbsd-hc.tar.gz).  This tarball contains 501
files, including 450 .hc files.

Target System 2

I unpacked the tarball on the target system, and ran the hc-build
script.  The first problem I ran into was the readline headers not
being found.  Setting 'ReadlineIncludePath=/usr/pkg/include' in the
mk/config.mk.in (see config.mk.in.diff) fixed this error.

The second problem I ran into was with the ieee_set_fp_control()
function in ghc/rts/Signals.c.  This function isn't available in
NetBSD alpha (or FreeBSD alpha I believe, not sure about OSF), only
Linux alpha.  I simply commented out the reference to the function
(see Signals.c.diff), but the file should be modified to check the OS.

The hc-build script then sucessfully went through the first "building
compiler" stage.  After that, in the "building libraries" stage, when
it reruns configure, it stalls when detecting the ghc version.  The
ghc-inplace compiler freezes when run.

That is where I am at now.  Does anyone have any clue why the inplace
compiler freezes, even when run with --version, and must be killed?

More information about the Glasgow-haskell-users mailing list