Skip to content

alex fails on hGetContents when building GHC using 9.2.1 on M1

Summary

Can't build GHC on M1 due to alex failure.

Steps to reproduce

This commit fixes some issues in hadrian: artempyanykh/ghc@2d7404b6

Then

export C_INCLUDE_PATH="`xcrun --show-sdk-path`/usr/include/ffi"

to fix up an issue with a missing header ffitarget_arm64.h

Then I run ./validate --build-only. The build starts, a bunch of stuff gets built, but then

ghc on  m1-build 
at 22:15:10 ❯ /Users/arr/.cabal/bin/alex -g compiler/GHC/Parser/Lexer.x -o _validatebuild/stage0/compiler/build/GHC/Parser/Lexer.hs --latin1   
alex: compiler/GHC/Parser/Lexer.x: hGetContents: invalid argument (invalid byte sequence)

ghc on  m1-build 
at 22:15:12 ❯ alex -v
Alex version 3.2.6, (c) 2003 Chris Dornan and Simon Marlow

Environment

  • GHC version used: 9.2.1

Optional:

  • Operating System: MacOS 12.0.1 (Monterey)
  • System Architecture: aarch64
Edited by Artem Pyanykh
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information