Skip to content

GHC infinite loop on Solaris

Hello, sometimes on Solaris ghc gets into infinite loop while trying to print something. E.g. ghc --version or ghc --info are good examples. This also happens for example while trying to build another ghc by already installed ghc. The reason for loop is simple: ghc is using libiconv for printing and libiconv is using its own libraries/binary tables. The problem arise when libiconv is not able to find the appropriate library/table file, then it tries to print error message (or GHC itself) which results in calling libiconv for printing which goes to search for appropriate library/table file and loop is closed. Please note that library/table file is different for different LANG settings. That also means that if you are able to invoke ghc --version on command line, still your ./configure of a new ghc may stuck on checking ghc version since configure sets LANG=C while on command line you may have LANG=en_US.UTF-8. Running ghc --version in truss shows this issue nicely as:

/1:     munmap(0xFF210000, 8790)                        = 0
/1:     access("/usr/lib/iconv/geniconvtbl/binarytables/646%UTF-32BE.bt", R_OK) Err#2 ENOENT
/1:     access("/usr/lib/iconv/646%UTF-32BE.so", R_OK)  Err#2 ENOENT
/1:     lwp_unpark(2)                                   = 0
/2:     lwp_park(0x00000000, 0)                         = 0
/2:     clock_gettime(4, 0xFF0D9E68)                    = 0
/2:     lwp_unpark(1)                                   = 0
/1:     lwp_park(0x00000000, 0)                         = 0
/1:     access("/usr/lib/iconv/geniconvtbl/binarytables/646%UTF-32BE.bt", R_OK) Err#2 ENOENT
/1:     access("/usr/lib/iconv/646%UTF-32BE.so", R_OK)  Err#2 ENOENT
/1:     open("/usr/lib/iconv/alias", O_RDONLY)          = 7
/1:     fstat64(7, 0xFFBFD388)                          = 0
/1:     fstat64(7, 0xFFBFD5C8)                          = 0
/1:     mmap(0x00000000, 8790, PROT_READ, MAP_SHARED, 7, 0) = 0xFF210000
/1:     close(7)                                        = 0
/1:     munmap(0xFF210000, 8790)                        = 0
/1:     access("/usr/lib/iconv/geniconvtbl/binarytables/646%UTF-32BE.bt", R_OK) Err#2 ENOENT
/1:     access("/usr/lib/iconv/646%UTF-32BE.so", R_OK)  Err#2 ENOENT
/1:     access("/usr/lib/iconv/geniconvtbl/binarytables/646%UTF-32BE.bt", R_OK) Err#2 ENOENT
/1:     access("/usr/lib/iconv/646%UTF-32BE.so", R_OK)  Err#2 ENOENT
/1:     open("/usr/lib/iconv/alias", O_RDONLY)          = 7
/1:     fstat64(7, 0xFFBFD388)                          = 0
/1:     fstat64(7, 0xFFBFD5C8)                          = 0

So, the solution on Solaris is simple. Install appropriate libiconv files. Usually if you are hit by this issue, then at least on Solaris 11 you are missing unicode-core package and this may be installed by:

# pkg install unicode-core
Trac metadata
Trac field Value
Version 7.8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Solaris
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information