7

When trying to install any package on my computer using a command like

cabal install http-conduit

the installation aborts with the following error:

/usr/bin/ld: --hash-size=31: unknown option

How can I resolve this?

Note: This question intentionally doesn't show research effort, because it was answered immediately in a Q&A-Style manner.

Uli Köhler
  • 13,012
  • 16
  • 70
  • 120

1 Answers1

4

This issue occurs with the binutils-gold package and GHC 7.4. There is an old mailing list entry discussing this issue.

You might need binutils-gold for LLVM for example, but GHC 7.4 can't handle the GOLD linker correctly, because it doesn't understand the --hash-size option.

As noted on the mailing list post, the solution to this is to remove binutils-gold, e.g. on Ubuntu use:

sudo apt-get remove binutils-gold

This will re-symlink /usr/bin/ld to a non-GOLD linker version. After that, repeat the cabal install command.

Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
  • [GHC can now use `gold` for linking](http://stackoverflow.com/questions/43243322/how-to-link-with-the-gnu-gold-linker-instead-of-ld-in-haskell/) and will not pass the problematic `--hash-size` flag when told to use gold. – nh2 Apr 05 '17 at 23:39