Building GHC 6.12 with GHC 6.12 + alex
aslatter at gmail.com
Thu Dec 31 13:35:46 EST 2009
On Thu, Dec 31, 2009 at 12:26 PM, Antoine Latter <aslatter at gmail.com> wrote:
> On Thu, Dec 31, 2009 at 9:19 AM, Antoine Latter <aslatter at gmail.com> wrote:
>> 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
>> 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
> Now, I get the following error on the same file:
> $ ~/src/alex/dist/build/alex/alex -g compiler/parser/Lexer.x -o compiler/stage1/
> alex: compiler/stage1/build/Lexer.hs: commitAndReleaseBuffer: invalid
> argument (Illegal byte sequence)
If I patch alex to explicitly set the encoding whenever it reads from
or writes to a file, all of these problems go away. I'm not really
sure why alex needs this and nothing else does, but so it goes.
Is there a separate bug tracker for alex, or should this just be a GHC bug?
More information about the Glasgow-haskell-users