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.
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.