Note: The extra environment variables are only required during the build/install phase.
$ wget https://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-x86_64-deb8-linux.tar.xz
$ tar ghc-8.0.1-x86_64-deb8-linux.tar.xz
$ cd ghc-8.0.1
$ export CONF_CC_OPTS_STAGE2=-fno-PIE
$ export CONF_GCC_LINKER_OPTS_STAGE2=-no-pie
$ export CONF_LD_LINKER_OPTS_STAGE2=-no-pie
$ export CONF_CC_OPTS_STAGE0=-no-pie
$ export CONF_GCC_LINKER_OPTS_STAGE0=-no-pie
$ export CONF_LD_LINKER_OPTS_STAGE0=-no-pie
$ export CONF_HC_OPTS_STAGE0=-optl=-no-pie
$ ./configure --prefix=$HOME/haskell/ghc-8.0.1
$ make install
If the above produces a GHC which gets the following error when building the
network
package (seen on Ubuntu 16.10):
/usr/bin/ld: final link failed: Nonrepresentable section on output
then the line above:
export CONF_CC_OPTS_STAGE2=-fno-PIE
should be changed to:
export CONF_CC_OPTS_STAGE2=-no-pie