Open Tehnix opened 7 years ago
I think you're using a stackage nightly in your project which has Cabal-2.x already, actually I can see that from the output above. That isn't supported by cabal-helper-0.7.x. The release of c-h-0.8 is pending the merging and deployment on hackage of https://github.com/haskell/cabal/pull/4714. After that we will need to release a version of ghc-mod compatible with c-h-0.8 which is the easy part.
For now you'll have to use lts-9.1 in your project (which appears to still have Cabal-1.24), sorry.
@DanielG thanks! You're right.
I have no idea how it ended in that state, nuking the .stack-work
dir in the folder seems to output the same. I don't know if stack or ghc-mod keeps something cached somewhere :/
You did change the resolver: __
setting in stack.yaml
, right?
Yeah, it's a bit of a weird issue with this folder only.
The stack.yaml
,
resolver: lts-9.1
packages:
- .
extra-deps: []
flags: {}
extra-package-dbs: []
Running ghc-mod check src/Parser.hs
,
[1 of 5] Compiling CabalHelper.Types ( CabalHelper/Types.hs, /Users/tehnix/.ghc-mod/cabal-helper/CabalHelper/Types.o )
[2 of 5] Compiling CabalHelper.Sandbox ( CabalHelper/Sandbox.hs, /Users/tehnix/.ghc-mod/cabal-helper/CabalHelper/Sandbox.o )
[3 of 5] Compiling CabalHelper.Licenses ( CabalHelper/Licenses.hs, /Users/tehnix/.ghc-mod/cabal-helper/CabalHelper/Licenses.o )
CabalHelper/Licenses.hs:56:8: error:
• Expecting one more argument to ‘CPackageIndex ModuleName’
Expected a type, but ‘CPackageIndex ModuleName’ has kind ‘* -> *’
• In the type signature:
findTransitiveDependencies :: CPackageIndex ModuleName
-> Set CInstalledPackageId -> Set CInstalledPackageId
ghc-mod: readCreateProcess: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/libexec/x86_64-osx-ghc-8.0.2/cabal-helper-0.7.3.0/cabal-helper-wrapper "--with-ghc=/Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/bin/ghc" "--with-ghc-pkg=/Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/bin/ghc-pkg" "--with-cabal=cabal" "/Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM" "/Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM/.stack-work/dist/x86_64-osx/Cabal-2.0.0.2" "package-db-stack" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-merged-pkg-options" "ghc-lang-options" "licenses" "flags" "config-flags" "non-default-config-flags" "compiler-version" (exit 1): failed
The cabal file contains,
name: Haskell-LLVM
version: 0.1.0.0
cabal-version: >=1.10
build-type: Simple
license: BSD3
license-file: LICENSE
copyright: Christian Kjaer Laustsen
maintainer: ckl@codetalk.io
category: Compiler
author: Christian Kjaer Laustsen
extra-source-files:
README.md
library
exposed-modules:
Parser
Lexer
Syntax
build-depends:
base >=4.7 && <5,
parsec -any
default-language: Haskell2010
hs-source-dirs: src
executable Haskell-LLVM-exe
main-is: Main.hs
build-depends:
base -any,
haskeline -any,
mtl -any,
Haskell-LLVM -any
default-language: Haskell2010
hs-source-dirs: app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
Also, I got it working outside of this, so it's not a pressing issue by any means, but I am still interested in what might be wrong though :)
Very strange. If $ stack path
also mentions that path: "/Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM/.stack-work/dist/x86_64-osx/Cabal-2.0.0.2"
(note the Cabal-2.0.0.2
bit) this sounds like a stack bug I guess. According to https://www.stackage.org/lts-9.1/package/Cabal the Cabal version should be 1.24 for lts-9.1.
Hmm,
I get (globally),
λ ~ $ stack path
stack-root: /Users/tehnix/.stack
project-root: /Users/tehnix/.stack/global-project
config-location: /Users/tehnix/.stack/global-project/stack.yaml
bin-path: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/bin:/Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/bin:/Users/tehnix/.rbenv/plugins/ruby-build/bin:/Users/tehnix/.rbenv/shims:/Users/tehnix/.rbenv/bin:/Users/tehnix/.local/bin:/usr/local/opt/pyenv/shims:/usr/local/opt/pyenv/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/Users/tehnix/.nix-profile/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
programs: /Users/tehnix/.stack/programs/x86_64-osx
compiler-exe: /Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/bin/ghc
compiler-bin: /Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/bin
local-bin: /Users/tehnix/.local/bin
extra-include-dirs:
extra-library-dirs:
snapshot-pkg-db: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/pkgdb
local-pkg-db: /Users/tehnix/.stack/global-project/.stack-work/install/x86_64-osx/lts-9.1/8.0.2/pkgdb
global-pkg-db: /Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d
ghc-package-path: /Users/tehnix/.stack/global-project/.stack-work/install/x86_64-osx/lts-9.1/8.0.2/pkgdb:/Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/pkgdb:/Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d
snapshot-install-root: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2
local-install-root: /Users/tehnix/.stack/global-project/.stack-work/install/x86_64-osx/lts-9.1/8.0.2
snapshot-doc-root: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/doc
local-doc-root: /Users/tehnix/.stack/global-project/.stack-work/install/x86_64-osx/lts-9.1/8.0.2/doc
dist-dir: .stack-work/dist/x86_64-osx/Cabal-2.0.0.2
local-hpc-root: /Users/tehnix/.stack/global-project/.stack-work/install/x86_64-osx/lts-9.1/8.0.2/hpc
local-bin-path: /Users/tehnix/.local/bin
ghc-paths: /Users/tehnix/.stack/programs/x86_64-osx
And inside my project,
λ Haskell/Haskell-LLVM $ stack path
stack-root: /Users/tehnix/.stack
project-root: /Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM
config-location: /Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM/stack.yaml
bin-path: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/bin:/Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/bin:/Users/tehnix/.rbenv/plugins/ruby-build/bin:/Users/tehnix/.rbenv/shims:/Users/tehnix/.rbenv/bin:/Users/tehnix/.local/bin:/usr/local/opt/pyenv/shims:/usr/local/opt/pyenv/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/Users/tehnix/.nix-profile/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
programs: /Users/tehnix/.stack/programs/x86_64-osx
compiler-exe: /Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/bin/ghc
compiler-bin: /Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/bin
local-bin: /Users/tehnix/.local/bin
extra-include-dirs:
extra-library-dirs:
snapshot-pkg-db: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/pkgdb
local-pkg-db: /Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM/.stack-work/install/x86_64-osx/lts-9.1/8.0.2/pkgdb
global-pkg-db: /Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d
ghc-package-path: /Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM/.stack-work/install/x86_64-osx/lts-9.1/8.0.2/pkgdb:/Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/pkgdb:/Users/tehnix/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d
snapshot-install-root: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2
local-install-root: /Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM/.stack-work/install/x86_64-osx/lts-9.1/8.0.2
snapshot-doc-root: /Users/tehnix/.stack/snapshots/x86_64-osx/lts-9.1/8.0.2/doc
local-doc-root: /Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM/.stack-work/install/x86_64-osx/lts-9.1/8.0.2/doc
dist-dir: .stack-work/dist/x86_64-osx/Cabal-2.0.0.2
local-hpc-root: /Users/tehnix/Dropbox/__Synced/Testing/Haskell/Haskell-LLVM/.stack-work/install/x86_64-osx/lts-9.1/8.0.2/hpc
local-bin-path: /Users/tehnix/.local/bin
ghc-paths: /Users/tehnix/.stack/programs/x86_64-osx
Notably the dist-dir: .stack-work/dist/x86_64-osx/Cabal-2.0.0.2
.
I tried rm
'ing the .stack-work
directory again in my project, doing stack install ghc-mod
, but I still end up at the same point. I don't really know where the dist-dir entry is getting set.
Should I move this over to stack's issue tracker instead?
Sounds like a plan, I really have no idea why Stack would have the Cabal version used to build projects deviate from the one in the stackage snapshot..
To sum up how I fixed it (although still remains how it got there), I went to ~/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d
where there was a Cabal-2.0.0.2-1HTE9d8rwAi7gJIdEHeKh7.conf
present, along with Cabal-1.24.2.0.conf
. I deleted Cabal-2.0.0.2-1HTE9d8rwAi7gJIdEHeKh7.conf
and now ghc-mod
works.
So:
$ rm ~/.stack/programs/x86_64-osx/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d/Cabal-2.0.0.2*
You can probably close this issue here, since this seems to be entirely on the stack
side of things.
haskell/cabal#4714 is now merged, but I can't tell if it's deployed on Hackage. Any idea where to check on the status of this?
We've made progress since the but cabal-helper remains the blocker. See https://github.com/DanielG/ghc-mod/issues/900#issuecomment-335448771.
Note that this same problem is an issue for recent Nix.
I really have no idea why Stack would have the Cabal version used to build projects deviate from the one in the stackage snapshot..
FYI https://github.com/commercialhaskell/stack/issues/3049 👍
So, with https://github.com/DanielG/ghc-mod/issues/900#issuecomment-353009192, this can move forward?
EDIT: Ah, that's you also hacking over there - sorry for the noise.
I seem to be getting the same error as reported in #831 whenever I try to run
ghc-mod check src/Parser.hs
.ghc-mod
was installed with stackage LTS 9.1, which seems to bringand internally use
cabal-helper
7.3.0 (at least according to stackage.org).The earlier issue I referenced seemed to have it solved by updating either
ghc-mod
orcabal-helper
, but both should be in sync here using the newest versions.I can also upload my source code that I'm trying it on it that helps. All the
stack.yaml
contains isresolver: lts-9.1
.