Skip to content

Can't build a project with GHC 9.12 if it has "ghc" library dependency #2432

@thomasjm

Description

@thomasjm

Describe the bug

If a package depends on the ghc library, I'm not able to build it with Haskell.nix and GHC 9.12.2. I made a repro here: https://github.com/thomasjm/ghc912-repro. You can try it by cloning the repo and running

nix build .#normal

I get a bunch of errors like this:

hc> Setup.hs:60:45: error: [8;;https://errors.haskell.org/messages/GHC-83865GHC-838658;;]                                                                                                                                                                                           
ghc>     * Couldn't match type: Distribution.Utils.Path.SymbolicPathX                                                                                                                                                                                                                
ghc>                              Distribution.Utils.Path.AllowAbsolute                                                                                                                                                                                                              
ghc>                              Distribution.Utils.Path.Pkg                                                                                                                                                                                                                        
ghc>                              Distribution.Utils.Path.File                                                                                                                                                                                                                       
ghc>                      with: [Char]                                                                                                                                                                                                                                               
ghc>       Expected: Maybe FilePath                                                                                                                                                                                                                                                  
ghc>         Actual: Maybe                                                                                                                                                                                                                                                           
ghc>                   (Distribution.Utils.Path.SymbolicPath                                                                                                                                                                                                                         
ghc>                      Distribution.Utils.Path.Pkg Distribution.Utils.Path.File)                                                                                                                                                                                                  
ghc>     * In the second argument of `(<$>)', namely `pkgDescrFile'                                                                                                                                                                                                                  
ghc>       In the expression: takeDirectory <$> pkgDescrFile                                                                                                                                                                                                                         
ghc>       In a pattern binding:                                                                                                                                                                                                                                                     
ghc>         Just compilerRoot = takeDirectory <$> pkgDescrFile                                                                                                                                                                                                                      
ghc>    |                                                                                                                                                                                                                                                                            
ghc> 60 |   let Just compilerRoot = takeDirectory <$> pkgDescrFile                                                                                                                                                                                                                   
ghc>    |                                             ^^^^^^^^^^^^              

Apparently this is due to the Setup.hs file for the ghc library being incompatible with some API changes made in the Cabal library in 3.14.0.0 (?). I don't understand why this happens, since according to the GHC 9.12.2 release notes, it should come with Cabal 3.14.1.0, so shouldn't it be compatible?

Expected behavior

The repro example should build successfully.

Additional context

This problem doesn't exist for GHC 9.10, as you can see by running the same command in this branch.

I actually tried patching the Setup.hs files to fix this. There are some patches in the repro which are currently commented out. I had to do it for both ghc and ghc-boot. That actually makes those packages build, but then it fails with a weird pragma error when trying to build ghc-lib. So I didn't try going further down that road.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions