Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackSetupShim misses Cabal-syntax dependency for newer GHC versions #5691

Closed
Topsii opened this issue Mar 9, 2022 · 2 comments
Closed

StackSetupShim misses Cabal-syntax dependency for newer GHC versions #5691

Topsii opened this issue Mar 9, 2022 · 2 comments

Comments

@Topsii
Copy link

Topsii commented Mar 9, 2022

Steps to reproduce

  1. Create a new project with stack new sample-project
  2. Edit stack.yaml to use a nightly ghc
resolver: nightly-2022-03-03
compiler: ghc-9.3.20220308 
system-ghc: true
packages:
- .
  1. Run stack build

Expected

project compiles successfully

Actual

PS C:\Users\Tobias\Documents\Uni\haskell\sample-project> stack build
Stack has not been tested with GHC versions above 9.0, and using 9.3.20220308, this may fail
Stack has not been tested with Cabal versions above 3.4, but version 3.7.0.0 was found, this may fail
[2 of 3] Compiling StackSetupShim   ( C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs, C:\sr\setup-exe-src\setup-shim-Z6RU0evB.o )

C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs:3:1: error:
    Could not load module ‘Distribution.PackageDescription’
    It is a member of the hidden package ‘Cabal-syntax-3.7.0.0’.
    You can run ‘:set -package Cabal-syntax’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
3 | import Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

--  While building simple Setup.hs (scroll up to its section to see the error) using:
      C:\Program Files\ghc-9.3.20220308-x86_64-unknown-mingw32\bin\ghc-9.3.20220308.exe -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.7.0.0 C:\sr\setup-exe-src\setup-Z6RU0evB.hs C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs -o C:\sr\setup-exe-cache\x86_64-windows\tmp-Cabal-simple_Z6RU0evB_3.7.0.0_ghc-9.3.20220308.exe
    Process exited with code: ExitFailure 1

More Information

Issue #5110 is similar and was apparently worked around by adding cabal to the setup-depends field.
More specific to my problem I have found the issue haskell/cabal#7974 where they talk about adding a setup-depends field with Cabal-syntax >= 3.7.
Unfortunately it does not work. The error message remains the same. I tried it by deleting package.yaml and editing stack.yaml and sample-project.cabal as follows:

resolver: nightly-2022-03-03
compiler: ghc-9.3.20220308
system-ghc: true
packages:
- .
extra-deps:
  - git: https://github.com/haskell/cabal.git
    commit: df6de322c5f36dae48282ebae55985935eaced37
    subdirs:
      - Cabal-syntax
      - Cabal   
  - directory-1.3.6.2@sha256:6e5f3e0adfe94483d5754d97d741b7d23a5e085d47176075b1955d4fa78f37aa,2811
  - process-1.6.11.0@sha256:d69428130705782d1b61ec8eab2f1d899fd5722ed804c44e104d798dce43e9fb,2819
  - time-1.11.1.2@sha256:a957467595420495c2dd440d9efa1f58c62277cf9438c7e7a515d7a4c65571ec,6287
cabal-version: 1.24

-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack

name:           sample-project
version:        0.1.0.0
description:    Please see the README on GitHub at <https://github.com/githubuser/sample-project#readme>
homepage:       https://github.com/githubuser/sample-project#readme
bug-reports:    https://github.com/githubuser/sample-project/issues
author:         Author name here
maintainer:     example@example.com
copyright:      2022 Author name here
license:        BSD3
license-file:   LICENSE
build-type:     Simple
extra-source-files:
    README.md
    ChangeLog.md

source-repository head
  type: git
  location: https://github.com/githubuser/sample-project
  
custom-setup
  setup-depends: base, Cabal >=3.7, Cabal-syntax >=3.7
  
library
  exposed-modules:
      Lib
  other-modules:
      Paths_sample_project
  hs-source-dirs:
      src
  build-depends:
      base >=4.7 && <5
  default-language: Haskell2010

executable sample-project-exe
  main-is: Main.hs
  other-modules:
      Paths_sample_project
  hs-source-dirs:
      app
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base >=4.7 && <5
    , sample-project
  default-language: Haskell2010

test-suite sample-project-test
  type: exitcode-stdio-1.0
  main-is: Spec.hs
  other-modules:
      Paths_sample_project
  hs-source-dirs:
      test
  ghc-options: -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base >=4.7 && <5
    , sample-project
  default-language: Haskell2010

Stack version

PS C:\Users\Tobias\Documents\Uni\haskell\sample-project> stack --version
Version 2.7.5, Git revision ba147e6f59b2da75b1beb98b1888cce97f7032b1 x86_64 hpack-0.34.4

Method of installation

  • Official binary, downloaded from stackage.org or fpcomplete's package repository
@AlistairB
Copy link

Possibly related to haskell/cabal#8370 ?

@mpilgrem
Copy link
Member

Closing, as I assume this was fixed by 718ee02.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants