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

1

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.

Ichor answered 25/1, 2014 at 2:36 Comment(0)
I
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.

Ichor answered 25/1, 2014 at 2:36 Comment(1)
GHC can now use gold for linking and will not pass the problematic --hash-size flag when told to use gold.Dated

© 2022 - 2024 — McMap. All rights reserved.