Search code examples
haskellinstallationcabalcabal-installhackage

Fail to install Hackage string-conversions


Problem

I was installing the Hackage string-conversions. However, it fails with the error below.

Error Log

Configuring string-conversions-0.3.0.3...
Building string-conversions-0.3.0.3...
Preprocessing library string-conversions-0.3.0.3...
[1 of 1] Compiling Data.String.Conversions ( Data/String/Conversions.hs, dist/build/Data/String/Conversions.o )
In-place registering string-conversions-0.3.0.3...
Creating package registration file:
/tmp/pkgConf-string-conversions-0.3.011675.3
cabal: Error: some packages failed to install:
string-conversions-0.3.0.3 failed during the final install step. The exception
was:
/tmp/pkgConf-string-conversions-0.3.011675.3: hGetContents: invalid argument
(invalid byte sequence)

Environment

Ubuntu GNOME: 14.10

ghc: 7.6.3

cabal: 1.20.0.2


Solution

  • I have finally figured out the solution.

    Rajarshi is right for the locale problem. However, changing the locale temporarily won't work.

    The package now correctly installed after changing the locale permanently.

    How to check the current locale setting

    1. $ locale

    2. If you notice that LANG is C or empty, probably it is not configured correctly

    How to change the locale setting permanently (Ubuntu)

    1. $ sudo update-locale LANG=en_US-UTF-8

    2. Log out and log in again

    References

    1. Locale - Community Help Wiki