Hsc2Hs/hGetContents encodings error

Simon Marlow marlowsd at gmail.com
Mon Nov 23 10:26:19 EST 2009

On 23/11/09 06:53, Daniel Schüssler wrote:
> Hi,
> I don't think this is the same problem as the one mentioned by Alex
> (installing `network' works for me):
> {----------------------------------------------
> $ cabal install X11
> Resolving dependencies...
> Configuring X11-
> configure: WARNING: unrecognized options: --with-compiler
> checking for gcc... gcc
> checking for C compiler default output file name... a.out
> [... configure stuff omitted...]
> checking for X11/cursorfont.h... yes
> configure: creating ./config.status
> config.status: creating config.mk
> config.status: creating X11.buildinfo
> config.status: creating include/HsX11Config.h
> config.status: creating include/X11_extras_config.h
> configure: WARNING: unrecognized options: --with-compiler
> Preprocessing library X11-
> hsc2hs: Graphics/X11/Xlib/Extras.hsc: hGetContents: invalid argument (Invalid
> or incomplete multibyte or wide character)

This is partly the result of new behaviour in 6.12.1RC2.  hGetContents 
now throws an exception if an I/O error is encountered, in a deliberate 
diversion from the Haskell 98 spec which says that it should terminate 
the stream silently.  We decided that this was the pertinent thing to do 
given that people are quite likely to encounter decoding errors with the 
new Unicode-aware I/O library, and silently ignoring the error would 
lead to large amounts of confusion.

> cabal: Error: some packages failed to install:
> X11- failed during the building phase. The exception was:
> ExitFailure 1
> ----------------------------------------------}
> Converting the offending file (Extras.hsc) to UTF-8 manually solves it:

Thanks to the wonderfully precise error message, you were able to fix 
the problem and get going again.  I declare this a victory :)


More information about the Glasgow-haskell-users mailing list