Skip to content

ghc-lib-parser-9.12.2.20250421 fails to build with ghc-9.12.2 on Windows 11 #603

@Eason0210

Description

@Eason0210

On Windows 11, I installed ghc 9.12.2 and cabal 3.14.2.0 with ghcup.

When I try to install ormolu with cabal install ormolu, will failed with the error as bellow:

> cabal install ormolu
Resolving dependencies...
Build profile: -w ghc-9.12.2 -O1
In order, the following will be built (use -v for more details):
 - Diff-1.0.2 (lib) (requires download & build)
 - alex-3.5.3.0 (exe:alex) (requires download & build)
 ... ( omitted a few lines here)
 - happy-2.1.5 (exe:happy) (requires download & build)
 - ghc-lib-parser-9.12.2.20250421 (lib) (requires download & build)
 - ormolu-0.8.0.0 (lib) (requires download & build)
 - ormolu-0.8.0.0 (exe:ormolu) (requires download & build)
Downloading  choice-0.2.4.1
Downloaded   choice-0.2.4.1
Downloaded   ormolu-0.8.0.0
 ... ( omitted a few lines here)
Installing   MemoTrie-0.6.9 (lib)
Completed    MemoTrie-0.6.9 (lib)
Installing   Diff-1.0.2 (lib)
Completed    Diff-1.0.2 (lib)
Installing   unliftio-0.2.25.1 (lib)
Completed    unliftio-0.2.25.1 (lib)
Building     ghc-lib-parser-9.12.2.20250421 (lib)

Failed to build ghc-lib-parser-9.12.2.20250421.
Build log (
C:\Users\Aqua\AppData\Local\cabal\logs\ghc-9.12.2\ghc-lib-parser-9.12.2._-78bb150ce88aba781a22a1b44514a659e5621e3c.log
):
Preprocessing library for ghc-lib-parser-9.12.2.20250421...
happy.exe: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.IOException:

compiler\GHC\Parser.y: hGetContents: invalid argument (cannot decode byte sequence starting from 183)

HasCallStack backtrace:
  collectBacktraces, called at libraries\ghc-internal\src\GHC\Internal\Exception.hs:169:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries\ghc-internal\src\GHC\Internal\Exception.hs:89:42 in ghc-internal:GHC.Internal.Exception
  throw, called at libraries\ghc-internal\src\GHC\Internal\IO\Handle\Text.hs:443:35 in ghc-internal:GHC.Internal.IO.Handle.Text

Error: [Cabal-7125]
Failed to build ghc-lib-parser-9.12.2.20250421 (which is required by exe:ormolu from ormolu-0.8.0.0). See the build log above for details.

But with cabal install ormolu with ghc-9.6.7 will succeed to install ormolu-0.7.7.0

I also try cabal install ghc-lib, failed with the same error:

❯ cabal install ghc-lib
Resolving dependencies...
Build profile: -w ghc-9.12.2 -O1
In order, the following will be built (use -v for more details):
 - ghc-lib-parser-9.12.2.20250421 (lib) (requires build)
 - ghc-lib-9.12.2.20250421 (lib) (requires download & build)
Warning:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: Installation might not be completed as desired! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The command "cabal install [TARGETS]" doesn't expose libraries.
* You might have wanted to add them as dependencies to your package. In this
case add "ghc-lib" to the build-depends field(s) of your package's .cabal
file.
* You might have wanted to add them to a GHC environment. In this case use
"cabal install --lib ghc-lib". The "--lib" flag is provisional: see
https://github.com/haskell/cabal/issues/6481 for more information.
Downloading  ghc-lib-9.12.2.20250421
Starting     ghc-lib-parser-9.12.2.20250421 (lib)
Building     ghc-lib-parser-9.12.2.20250421 (lib)
Downloaded   ghc-lib-9.12.2.20250421

Failed to build ghc-lib-parser-9.12.2.20250421.
Build log (
C:\Users\Aqua\AppData\Local\cabal\logs\ghc-9.12.2\ghc-lib-parser-9.12.2._-78bb150ce88aba781a22a1b44514a659e5621e3c.log
):
Preprocessing library for ghc-lib-parser-9.12.2.20250421...
happy.exe: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.IOException:

compiler\GHC\Parser.y: hGetContents: invalid argument (cannot decode byte sequence starting from 183)

HasCallStack backtrace:
  collectBacktraces, called at libraries\ghc-internal\src\GHC\Internal\Exception.hs:169:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries\ghc-internal\src\GHC\Internal\Exception.hs:89:42 in ghc-internal:GHC.Internal.Exception
  throw, called at libraries\ghc-internal\src\GHC\Internal\IO\Handle\Text.hs:443:35 in ghc-internal:GHC.Internal.IO.Handle.Text

Error: [Cabal-7125]
Failed to build ghc-lib-parser-9.12.2.20250421 (which is required by ghc-lib-9.12.2.20250421). See the build log above for details.

If you need more infomation, please let me knonw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions