Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 384
Uli Köhler Avatar asked Jan 25 '14 02:01

Uli Köhler


1 Answers

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.

like image 158
Uli Köhler Avatar answered Sep 19 '22 16:09

Uli Köhler