Closed sureyeaah closed 4 years ago
Same question as in https://github.com/Infinisil/all-hies/issues/40 Can not reproduce with all-hies. Please more information, does it happen on all projects or only one? If only one, can you maybe share it?
Looks simple - hie
uses cabal when the user expects to use stack
?
It is using the stack cradle:
2020-01-09 23:04:36.816118642 [ThreadId 35] - Found cradle: Cradle {cradleRootDir = "/mnt/DATA/Code/pretty-simple", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
Problem is somehow related to Cabal
. Stack still uses Cabal
right?
Same question as in Infinisil/all-hies#40 Can not reproduce with all-hies. Please more information, does it happen on all projects or only one? If only one, can you maybe share it?
It happens with the pretty-simple project only.
Can reproduce on pretty-simple
with cabal-helper.
Adding hie.yaml
cradle:
stack:
works though.
Interesting observation:
cabal says the Cabal version ought to be Cabal 2.4.0.1
in the stack lts, a Cabal version of Cabal 2.4.1.0
is specified.
Relevant cabal-helper logs: https://gist.github.com/fendor/e572957ef3523d60a6653e77654beba9
Output of stack -v build
> stack -v build
2.1.3.1 x86_64 hpack-0.33.0
2020-01-10 16:30:19.753304: [debug] Checking for project config at: /home/baldr/Documents/haskell/pretty-simple/stack.yaml
2020-01-10 16:30:19.753755: [debug] Loading project config file stack.yaml
2020-01-10 16:30:19.765430: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-01-09 15:30:19.765338609 UTC]
2020-01-10 16:30:19.766173: [debug] Using package location completions from a lock file
2020-01-10 16:30:19.925613: [debug] PATH is: Just "/home/baldr/.cabal/bin:/home/baldr/.local/bin:/nix/store/r7k59wvjl8x21m6a61xy52clydwmkdc5-kitty-0.14.6/bin:/nix/store/js1paxhg4x6qhs0q8rqm7fbz2lk0m0ka-imagemagick-6.9.10-71/bin:/nix/store/ia8n9p2bnidx3jfbj4a9q61hzyim6x0y-xsel-unstable-2018-01-10/bin:/nix/store/jwhd7yi26sfbi5djclxrr3ims6r5796i-ncurses-6.1-20190112-dev/bin:/home/baldr/bin:/run/wrappers/bin:/home/baldr/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/baldr/.nix-profile/bin:/etc/profiles/per-user/baldr/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
2020-01-10 16:30:19.925715: [debug] Using a nix-shell environment with nix packages: haskell.compiler.ghc865, git, gcc, gmp
2020-01-10 16:30:19.926060: [debug] Run process: /home/baldr/.nix-profile/bin/nix-shell --pure -E "with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc865 git gcc gmp]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib'' ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs; in runCommand ''myEnv'' { buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; LANG=\"en_US.UTF-8\";} \"\"" --run "'/nix/store/8h0dkdjxjdrnvwsp8l0wp9infn9j010l-stack-2.1.3.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=2.1.3.1' '-v' 'build'"
2.1.3.1 x86_64 hpack-0.33.0
2020-01-10 16:30:21.198191: [debug] Checking for project config at: /home/baldr/Documents/haskell/pretty-simple/stack.yaml
2020-01-10 16:30:21.198342: [debug] Loading project config file stack.yaml
2020-01-10 16:30:21.201440: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-01-09 15:30:21.201411315 UTC]
2020-01-10 16:30:21.202115: [debug] Using package location completions from a lock file
2020-01-10 16:30:21.348285: [debug] Asking for a supported GHC version
2020-01-10 16:30:21.348356: [debug] Getting system compiler version
2020-01-10 16:30:21.349030: [debug] SELECT "id","actual_version","arch","ghc_path","ghc_size","ghc_modified","ghc_pkg_path","runghc_path","haddock_path","cabal_version","global_db","global_db_cache_size","global_db_cache_modified","info","global_dump" FROM "compiler_cache" WHERE "ghc_path"=?; [PersistText "/nix/st
ore/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin/ghc-8.6.5"]
2020-01-10 16:30:21.403662: [debug] Loaded compiler information from cache
2020-01-10 16:30:21.403990: [debug] Asking for a supported GHC version
2020-01-10 16:30:21.404262: [debug] Resolving package entries
2020-01-10 16:30:21.404446: [debug] Parsing the targets
2020-01-10 16:30:21.416565: [debug] Checking flags
2020-01-10 16:30:21.416661: [debug] SourceMap constructed
2020-01-10 16:30:21.423797: [debug] Starting to execute command inside EnvConfig
2020-01-10 16:30:21.428288: [debug] Finding out which packages are already installed
2020-01-10 16:30:21.428513: [debug] Run process: /nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2020-01-10 16:30:21.481412: [debug] Process finished in 53ms: /nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2020-01-10 16:30:21.493900: [debug] Ignoring package Cabal due to wanting version 2.4.1.0 instead of 2.4.0.1
2020-01-10 16:30:21.494494: [debug] Ignoring package haskeline due to wanting version 0.7.5.0 instead of 0.7.4.3
2020-01-10 16:30:21.496508: [debug] Run process: /nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/baldr/.stack/snapshots/x86_64-linux-nix/bde0d1ad09d89b6666bde10aa3c5c44645a8cca66e37d594dfeee85be7c21f3d/8.6.5/pkgdb dump --expand-pkgroot
2020-01-10 16:30:21.536515: [debug] Process finished in 40ms: /nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/baldr/.stack/snapshots/x86_64-linux-nix/bde0d1ad09d89b6666bde10aa3c5c44645a8cca66e37d594dfeee85be7c21f3d/8.6.5/pkgdb dump --expand-pkgroot
2020-01-10 16:30:21.539220: [debug] Run process: /nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/baldr/Documents/haskell/pretty-simple/.stack-work/install/x86_64-linux-nix/bde0d1ad09d89b6666bde10aa3c5c44645a8cca66e37d594dfeee85be7c21f3d/8.6.5/pkgdb dump --expand-pkgroot
2020-01-10 16:30:21.576523: [debug] Process finished in 37ms: /nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin/ghc-pkg-8.6.5 --user --no-user-package-db --package-db /home/baldr/Documents/haskell/pretty-simple/.stack-work/install/x86_64-linux-nix/bde0d1ad09d89b6666bde10aa3c5c44645a8cca66e37d594dfeee85be7c21f3d/8.6.5/pkgdb dump --expand-pkgroot
2020-01-10 16:30:21.577398: [debug] Constructing the build plan
2020-01-10 16:30:21.578688: [debug] SELECT "id","directory","type","pkg_src","active","path_env_var","haddock" FROM "config_cache" WHERE "directory"=? AND "type"=?; [PersistText "/home/baldr/Documents/haskell/pretty-simple/.stack-work/install/x86_64-linux-nix/bde0d1ad09d89b6666bde10aa3c5c44645a8cca66e37d594dfeee85be7c21f3d/8.6.5/",PersistText "lib:pretty-simple-3.2.0.0-1YUugJ2stCkGqd2EY55KQU"]
2020-01-10 16:30:21.579034: [debug] SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 6]
2020-01-10 16:30:21.579225: [debug] SELECT "id", "config_cache_id", "index", "option" FROM "config_cache_no_dir_option" WHERE ("config_cache_id"=?) ORDER BY "index"; [PersistInt64 6]
2020-01-10 16:30:21.579429: [debug] SELECT "id", "config_cache_id", "ghc_pkg_id" FROM "config_cache_dep" WHERE ("config_cache_id"=?); [PersistInt64 6]
2020-01-10 16:30:21.579553: [debug] SELECT "id", "config_cache_id", "component" FROM "config_cache_component" WHERE ("config_cache_id"=?); [PersistInt64 6]
2020-01-10 16:30:21.580340: [debug] Start: getPackageFiles /home/baldr/Documents/haskell/pretty-simple/pretty-simple.cabal
2020-01-10 16:30:21.594169: [debug] Finished in 14ms: getPackageFiles /home/baldr/Documents/haskell/pretty-simple/pretty-simple.cabal
2020-01-10 16:30:21.596244: [debug] Checking if we are going to build multiple executables with the same name
2020-01-10 16:30:21.596350: [debug] Executing the build plan
Lines I think are important:
2020-01-10 16:30:21.481412: [debug] Process finished in 53ms: /nix/store/hg3na12737n7wws1kndxvs95ai88fgn8-ghc-8.6.5/bin/ghc-pkg-8.6.5 --global --no-user-package-db dump --expand-pkgroot
2020-01-10 16:30:21.493900: [debug] Ignoring package Cabal due to wanting version 2.4.1.0 instead of 2.4.0.1
2020-01-10 16:30:21.494494: [debug] Ignoring package haskeline due to wanting version 0.7.5.0 instead of 0.7.4.3
Another side note:
Modifying stack.yaml
to use Cabal-2.4.0.1 works, too.
resolver: lts-13.30
# Local packages, usually specified by relative directory name
packages:
- '.'
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps:
- Cabal-2.4.0.1
Then it works even without hie.yaml
This looks very similar to DanielG/cabal-helper#78 but the failure mode is somewhat different. Over in that issue we're getting a GHC error when trying to compile the helper but here we seem to get past that stage to actually running the helper.
It appears here the problem is that Stack is choosing to pull in the lib:Cabal from the snapshot package-db rather than GHC's global db due to build-type:custom
in pretty-simple's cabal file.
Unfortunately we've had assumed the invariant that stack can only have one Cabal version for so long that this now causes a bit of a staging problem in the implementation where we need to know the Cabal version we're going to use before telling Stack to actually run configuration, which would make it possible to read it out from the setup-config
header.
An easy fix would be to just always configure immediately for stack but that sucks performance wise. I'll have to do some reading of the scriptures (aka Stack source code) to figure out if we can do any better.
In the meantime either modifying the setup-depends
section in the cabal file or adding extra-deps
in stack.yaml to force the correct Cabal version seems like a good workaround.
Should be fixed now by the update to cabal-helper 1.1
I'm using
hie-8.6.5 v1.0.0.0
on pretty-simple.HIE starts fine but throws an error message if I try to perform some action (e.g. go-to-definition).
stack build
works just fine. I had no issues while using v0.14.0.0.Log: