How to solve ghc-stage2: mkTextEncoding: invalid argument (Invalid argument) issue.

Duncan Coutts duncan.coutts at
Tue Sep 15 14:21:26 EDT 2009

On Tue, 2009-09-15 at 16:56 +0200, Karel Gardas wrote:
> Hello,
> recently I've found out that my solaris-based GHC buildbot is completely
> unusable since it always (when it get to, which means it does not fail
> with usual magic number mismatch: old/corrupt interface file?) fails with:

> ghc-stage2: mkTextEncoding: invalid argument (Invalid argument)

So that's when it calls iconv_open with the names of some text
encodings. Apparently that is failing. You should be able to confirm
this with some tracing.

> I've even tried to update my building GHC from 6.8.3 to 6.10.4, but it
> still does not help.

No, it wouldn't.

> Since I would really like to resurrect my GHC buildbot, do you have any
> idea how to fix this issue?

Dig into base/GHC/IO/Encoding/Iconv.hs mkTextEncoding function where it
calls iconv_open, see what it's being called with.

In particular check if HAVE_LANGINFO_H is getting defined. If it's not
then the code assumes GNU iconv.

> PS: for reference, please have a look at

See also the

Which is running Solaris 10 on sparc and seems to be working fine.


More information about the Glasgow-haskell-users mailing list