Setting Up a OpenBSD System for Building GHC

note: this is for building on OpenBSD Current as of 2017-04-05
note: The wxallow setting will reduce your security (From OpenBSD's point of view)


  • The wxallowed mount option must be specified for the filesystem where the build will take place, and optionally /tmp

You can either set it by editing the /etc/fstab like so:

01020304050607.h /usr/local ffs rw,nodev,wxallowed 1 2 

and rebooting, or you can temporary set a mount as wxallowed by running this command: mount -uo wxallowed /usr/local. (where /usr/local is the partition you'd like to affected, run mount to see them all) See for a more detailed explanation.

  • The login class for the user you will be performed the build as needs to have a sufficiently large 'datasize' (datasize-cur: 4096M has been known to work)

Required Tools

Install the required tools:

doas pkg_add ghc gmake autoconf%2.69 automake%1.15 gmp libiconv alex happy git

to also (optionally) build the docs

doas pkg_add py-sphinx

Some required environment variables


Optionally (if your /tmp does not have the wxallowed mount option (don't forget to mkdir $HOME/tmp))

export TMP=$HOME/tmp
export TEMP=$HOME/tmp

Get the Sources

see Getting the sources


./configure --with-iconv-libraries=/usr/local/lib \
--with-iconv-includes=/usr/local/include \
--with-gmp-libraries=/usr/local/lib \
--with-gmp-includes=/usr/local/include \
--with-ffi-libraries=/usr/local/lib \
--with-ffi-includes=/usr/local/include \

see also Quick Start: just build GHC

Last modified 4 months ago Last modified on Apr 10, 2017 4:19:16 AM