Skip to content

HLS fails to compile with GHC 9.12.3 #4784

@botantony

Description

@botantony

Your environment

Which OS do you use?

macOS Tahoe 26.1, M2 processor

Which version of GHC do you use and how did you install it?

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.12.3
$ cabal --version
cabal-install version 3.16.1.0
compiled using version 3.16.1.0 of the Cabal library (in-tree)

I installed them via Homebrew (brew install ghc@9.12 cabal-install)

How is your project built (alternative: link to the project)?

Which LSP client (editor/plugin) do you use?

None

Which version of HLS do you use and how did you install it?

I tried to build 2.12.0.0 and the latest commit in master branch (7ce9de1)

Have you configured HLS in any way (especially: a hie.yaml file)?

No

Steps to reproduce

# Install GHC 9.12.3 first
cabal v2-update
cabal v2-build

Expected behaviour

HLS compiles successfully

Actual behaviour

This compilation error raised from ghc-lib-parser:

[421 of 456] Compiling GHC.Iface.Errors.Ppr ( compiler/GHC/Iface/Errors/Ppr.hs, dist/build/GHC/Iface/Errors/Ppr.o, dist/build/GHC/Iface/Errors/Ppr.dyn_o )
[422 of 456] Compiling GHC.Tc.Errors.Ppr ( compiler/GHC/Tc/Errors/Ppr.hs, dist/build/GHC/Tc/Errors/Ppr.o, dist/build/GHC/Tc/Errors/Ppr.dyn_o )
compiler/GHC/Tc/Errors/Ppr.hs:44:1: error: [GHC-61948]
    Could not find module ‘GHC.Internal.TH.Ppr’.
    Perhaps you meant
      GHC.Internal.TH.Lib (from ghc-internal-9.1203.0)
      GHC.Internal.Ptr (from ghc-internal-9.1203.0)
      GHC.Internal.TH.Lift (from ghc-internal-9.1203.0)
    Use -v to see a list of the files searched for.
   |
44 | import qualified GHC.Internal.TH.Ppr as TH
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

One thing I noticed is that it uses ghc-lib-parser 9.12.2.20250421, even though 9.12.3.20251228 is available

...
In order, the following will be built:
 - ghc-lib-parser-9.12.2.20250421 (lib) (requires build)
...

I tried to manually add the constraint and see if it works:

diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal
index 23260a539..8bbf617cb 100644
--- a/haskell-language-server.cabal
+++ b/haskell-language-server.cabal
@@ -757,7 +757,7 @@ library hls-hlint-plugin
   if flag(ghc-lib)
     cpp-options:   -DGHC_LIB
     build-depends:
-        ghc-lib-parser
+        ghc-lib-parser >= 9.12.3
   else
     build-depends:
         ghc
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: haskell-language-server-2.12.0.0 (user goal)
[__1] trying: haskell-language-server:+hlint
[__2] trying: haskell-language-server:+ghc-lib
[__3] next goal: ghc-lib-parser (dependency of haskell-language-server +ghc-lib +hlint)
[__3] rejecting: ghc-lib-parser; 9.12.2.20250421, 9.12.2.20250320, 9.12.1.20250314, 9.12.1.20250105, 9.12.1.20250103, 9.12.1.20241218, 9.10.2.20250515, 9.10.2.20250503, 9.10.1.20250421, 9.10.1.20250103, 9.10.1.20241103, 9.10.1.20240511, 9.8.5.20250214, 9.8.4.20241130, 9.8.3.20241103, 9.8.3.20241022, 9.8.2.20240223, 9.8.1.20231121, 9.8.1.20231009, 9.6.7.20250325, 9.6.6.20240701, 9.6.5.20240423, 9.6.4.20240109, 9.6.3.20231121, 9.6.3.20231014, 9.6.2.20231121, 9.6.2.20230523, 9.6.1.20230312, 9.4.8.20231111, 9.4.7.20230826, 9.4.6.20230808, 9.4.5.20230430, 9.4.4.20221225, 9.4.3.20221104, 9.4.2.20220822, 9.4.1.20220807, 9.2.8.20230729, 9.2.7.20230228, 9.2.6.20230211, 9.2.5.20221107, 9.2.4.20220729, 9.2.3.20220709, 9.2.3.20220527, 9.2.2.20220307, 9.2.1.20220109, 9.2.1.20211101, 9.2.1.20211030, 9.0.2.20211226, 9.0.1.20210324, 9.0.1.20210207, 9.0.1.20210205, 8.10.7.20220219, 8.10.7.20210828, 8.10.6.20210814, 8.10.5.20210606, 8.10.4.20210206, 8.10.3.20201220, 8.10.2.20200916, 8.10.2.20200808, 8.10.1.20200916, 8.10.1.20200523, 8.10.1.20200518, 8.10.1.20200412, 8.10.1.20200324, 8.8.4.20210620, 8.8.4.20200716, 8.8.3.20210620, 8.8.3.20200412.1, 8.8.3.20200412, 8.8.3.20200224, 8.8.2.20210620, 8.8.2.20200205, 8.8.2, 8.8.1.20210620, 8.8.1.20191204, 8.8.1, 8.8.0.20190723, 8.8.0.20190424, 0.20221201, 0.20221101, 0.20221001, 0.20220901, 0.20220801, 0.20220701, 0.20220601, 0.20220501, 0.20220401, 0.20220301, 0.20220201, 0.20220103, 0.20211201, 0.20211101, 0.20211001, 0.20210901, 0.20210801, 0.20210701, 0.20210601, 0.20210501, 0.20210331, 0.20210228, 0.20210201, 0.20210101, 0.20201201, 0.20201101, 0.20201001, 0.20200901, 0.20200801, 0.20200704, 0.20200601, 0.20200501, 0.20200401, 0.20200301, 0.20200205, 0.20200201, 0.20200102, 0.20191201, 0.20191101, 0.20191002, 0.20190909, 0.20190903, 0.20190806, 0.20190703, 0.20190603, 0.20190523, 0.20190516, 0.20190423, 0.20190402 (conflict: haskell-language-server +ghc-lib +hlint => ghc-lib-parser>=9.12.3)
[__3] fail (backjumping, conflict set: ghc-lib-parser, haskell-language-server, haskell-language-server:ghc-lib, haskell-language-server:hlint)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: ghc-lib-parser (1536), haskell-language-server (376), haskell-language-server:ghc-lib (166), haskell-language-server:hlint (166)

Debug information

Build logs (cabal v2-build -v2): https://gist.github.com/botantony/7f819482c5e2e39b033e328f57f5a3c4
Build logs with constraint: https://gist.github.com/botantony/ace2f3444a58271b537f6ce69268f820

Metadata

Metadata

Assignees

No one assigned

    Labels

    GHCissues with particular GHC versionstype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions