Stack Exchange
Trouble Installing GHCJS DOM Package
I'm trying to install GHCJS.  When I run cabal install ghcjs-dom, it tells me
Cannot find gtk2hsC2hs
Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).

Ok, here we go then...
~/Haskell/ghcjs-test/domTest: cabal install gtk2hs-buildtools
Resolving dependencies...
Configuring gtk2hs-buildtools-0.13.0.5...
Building gtk2hs-buildtools-0.13.0.5...
Failed to install gtk2hs-buildtools-0.13.0.5
Build log ( /Users/markkaravan/.cabal/logs/gtk2hs-buildtools-0.13.0.5.log ):
Configuring gtk2hs-buildtools-0.13.0.5...
Building gtk2hs-buildtools-0.13.0.5...
Preprocessing executable 'gtk2hsTypeGen' for gtk2hs-buildtools-0.13.0.5...
[1 of 2] Compiling Paths_gtk2hs_buildtools ( dist/build/autogen/Paths_gtk2hs_buildtools.hs, dist/build/gtk2hsTypeGen/gtk2hsTypeGen-tmp/Paths_gtk2hs_buildtools.o )
[2 of 2] Compiling Main             ( hierarchyGen/TypeGen.hs, dist/build/gtk2hsTypeGen/gtk2hsTypeGen-tmp/Main.o )
Linking dist/build/gtk2hsTypeGen/gtk2hsTypeGen ...
Preprocessing executable 'gtk2hsHookGenerator' for
gtk2hs-buildtools-0.13.0.5...
[1 of 2] Compiling Paths_gtk2hs_buildtools ( dist/build/autogen/Paths_gtk2hs_buildtools.hs, dist/build/gtk2hsHookGenerator/gtk2hsHookGenerator-tmp/Paths_gtk2hs_buildtools.o )
[2 of 2] Compiling Main             ( callbackGen/HookGenerator.hs, dist/build/gtk2hsHookGenerator/gtk2hsHookGenerator-tmp/Main.o )
Linking dist/build/gtk2hsHookGenerator/gtk2hsHookGenerator ...
Preprocessing executable 'gtk2hsC2hs' for gtk2hs-buildtools-0.13.0.5...
[ 1 of 41] Compiling DLists           ( c2hs/base/general/DLists.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/DLists.o )
[ 2 of 41] Compiling BaseVersion      ( c2hs/base/admin/BaseVersion.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/BaseVersion.o )
[ 3 of 41] Compiling Switches         ( c2hs/state/Switches.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Switches.o )
[ 4 of 41] Compiling Map              ( c2hs/base/general/Map.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Map.o )
[ 5 of 41] Compiling FastMutInt       ( c2hs/base/general/FastMutInt.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/FastMutInt.o )
[ 6 of 41] Compiling Config           ( c2hs/base/admin/Config.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Config.o )
[ 7 of 41] Compiling C2HSConfig       ( c2hs/toplevel/C2HSConfig.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/C2HSConfig.o )
[ 8 of 41] Compiling CInfo            ( c2hs/gen/CInfo.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CInfo.o )
[ 9 of 41] Compiling Version          ( c2hs/toplevel/Version.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Version.o )
[10 of 41] Compiling Binary           ( c2hs/base/general/Binary.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Binary.o )
[11 of 41] Compiling Position         ( c2hs/base/general/Position.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Position.o )
[12 of 41] Compiling UNames           ( c2hs/base/general/UNames.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/UNames.o )
[13 of 41] Compiling Errors           ( c2hs/base/errors/Errors.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Errors.o )
[14 of 41] Compiling Attributes       ( c2hs/base/syms/Attributes.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Attributes.o )
[15 of 41] Compiling Idents           ( c2hs/base/syms/Idents.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Idents.o )
[16 of 41] Compiling CTokens          ( c2hs/c/CTokens.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CTokens.o )
[17 of 41] Compiling CAST             ( c2hs/c/CAST.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CAST.o )
[18 of 41] Compiling CPretty          ( c2hs/c/CPretty.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CPretty.o )
[19 of 41] Compiling Lexers           ( c2hs/base/syntax/Lexers.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Lexers.o )

c2hs/base/syntax/Lexers.hs:133:1: Warning: Tab character

c2hs/base/syntax/Lexers.hs:134:1: Warning: Tab character
...

c2hs/base/syntax/Lexers.hs:518:1: Warning: Tab character

c2hs/base/syntax/Lexers.hs:519:1: Warning: Tab character

c2hs/base/syntax/Lexers.hs:520:1: Warning: Tab character

c2hs/base/syntax/Lexers.hs:520:15: Warning: Tab character
[20 of 41] Compiling StateTrans       ( c2hs/base/state/StateTrans.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/StateTrans.o )
[21 of 41] Compiling StateBase        ( c2hs/base/state/StateBase.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/StateBase.o )
[22 of 41] Compiling NameSpaces       ( c2hs/base/syms/NameSpaces.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/NameSpaces.o )
[23 of 41] Compiling CAttrs           ( c2hs/c/CAttrs.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CAttrs.o )
[24 of 41] Compiling CBuiltin         ( c2hs/c/CBuiltin.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CBuiltin.o )
[25 of 41] Compiling CParserMonad     ( c2hs/c/CParserMonad.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CParserMonad.o )
[26 of 41] Compiling CLexer           ( dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CLexer.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CLexer.o )

dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CLexer.hs:463:29:
    Couldn't match expected type ‘Bool’ with actual type ‘Int#’
    In the first argument of ‘(&&)’, namely ‘(offset >=# 0#)’
    In the expression: (offset >=# 0#) && (check ==# ord_c)
    In the expression:
      if (offset >=# 0#) && (check ==# ord_c) then
          alexIndexInt16OffAddr alex_table offset
      else
          alexIndexInt16OffAddr alex_deflt s

dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/CLexer.hs:463:48:
    Couldn't match expected type ‘Bool’ with actual type ‘Int#’
    In the second argument of ‘(&&)’, namely ‘(check ==# ord_c)’
    In the expression: (offset >=# 0#) && (check ==# ord_c)
    In the expression:
      if (offset >=# 0#) && (check ==# ord_c) then
          alexIndexInt16OffAddr alex_table offset
      else
          alexIndexInt16OffAddr alex_deflt s
cabal: Error: some packages failed to install:
gtk2hs-buildtools-0.13.0.5 failed during the building phase. The exception
was:
ExitFailure 1

In this situation, is it actually wise to mess with these source files that have type errors, or is there a better way to go about this?

If one question is solved please mark the most suitable answer as correct and for errors occurring afterwards, please consider asking a different question. Multiple edits make future searches more difficult.

have you checked if pkg-config is installed on your system?

I deleted that edit.  Installed pkg-config, now working through lots of brew installs...

Try to update alex (and probably happy). See here for details: https://ro-che.info/articles/2014-03-08-happy-alex-ghc-7.8.html
