Skip to content

Instantly share code, notes, and snippets.

@nhibberd
Created February 20, 2018 19:32
Show Gist options
  • Save nhibberd/513d1eb194e5b02239ae11c5a4409ddb to your computer and use it in GitHub Desktop.
Save nhibberd/513d1eb194e5b02239ae11c5a4409ddb to your computer and use it in GitHub Desktop.
ghc installation on linux

Install GHC 8.0.1 (Linux)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment