Building GHC 6.12 with GHC 6.12 + alex

Antoine Latter aslatter at gmail.com
Thu Dec 31 13:26:44 EST 2009


On Thu, Dec 31, 2009 at 9:19 AM, Antoine Latter <aslatter at gmail.com> wrote:
> Folks,
>
> I've run into trouble building GHC 6.12 with alex built from GHC 6.12:
>
> "/Users/alatter/usr/bin/alex"  -g compiler/parser/Lexer.x -o
> compiler/stage1/build/Lexer.hs
> alex: compiler/parser/Lexer.x: hGetContents: invalid argument (Illegal
> byte sequence)
>
> however things like:
>
> ghci> readFile "compiler/parser/Lexer.x"
>
> apear to work just fine. Has anyone else seen this? Has anyone else
> succeeded in this?
>
> This is on Mac OS X 10.6, running on Intel Core 2 Duo. I'm trying to
> compile a recent pull of the 6.12 branch.
>

I've progressed to an advanced state of disfunction. I've patched alex
src/Main.hs to use the following:

#if __GLASGOW_HASKELL__ >= 612
readFile :: FilePath -> IO String
readFile file = do
  h <- openFile file ReadMode
  hSetEncoding h utf8
  hGetContents h
#endif

Now, I get the following error on the same file:

$ ~/src/alex/dist/build/alex/alex -g compiler/parser/Lexer.x -o compiler/stage1/
build/Lexer.hs
alex: compiler/stage1/build/Lexer.hs: commitAndReleaseBuffer: invalid
argument (Illegal byte sequence)


More information about the Glasgow-haskell-users mailing list