commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.98k stars 843 forks source link

Don't work `stack script --resolver lts-9.3 --package ghc --package ghc-paths` #3416

Closed waddlaw closed 5 years ago

waddlaw commented 7 years ago

Failure bolow command.

$ stack script Main.hs --resolver lts-9.3 --package ghc --package ghc-paths

But, success below command.

$ stack script Main.hs --resolver lts-9.3 --package ghc-paths
$ stack script Main.hs --resolver lts-9.3 --package ghc --package ghc-paths

Steps to reproduce

  1. Clean dir rm -rf ~/.stack
  2. Create Main.hs
    
    module Main where

main :: IO () main = undefined

3. Run `stack script Main.hs --resolver lts-9.3 --package ghc --package ghc-paths`

### Expected

I expected that displayed to result (`undefined`) after build & run.

### Actual

#### Failure case
Not found `ghc` package error.

```bash
$ stack script test.hs --resolver lts-9.3 --package ghc --package ghc-paths --verbose
Version 1.5.1, Git revision 2b0392468a03174a7c5d317291c62452d771b055 x86_64 hpack-0.18.1
2017-09-05 18:13:21.093922: [debug] Ignoring config files
@(Stack/Config.hs:915:13)
2017-09-05 18:13:21.094564: [debug] Using resolver: lts-9.3 specified on command line
@(Stack/Config.hs:537:7)
2017-09-05 18:13:21.094643: [info] Using resolver: lts-9.3 specified on command line
@(Stack/Config.hs:628:17)
2017-09-05 18:13:21.094830: [debug] Decoding build plan from: /home/foo/.stack/build-plan/lts-9.3.yaml
@(Stack/Snapshot.hs:151:5)
2017-09-05 18:13:22.319973: [debug] Run process: /sbin/ldconfig -p
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.321808: [debug] Process finished in 1ms: /sbin/ldconfig -p
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.322099: [debug] Run process: /usr/bin/gcc -v
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.323198: [debug] Process finished in 1ms: /usr/bin/gcc -v
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.323300: [debug] PIE enabled
@(Stack/Setup.hs:585:17)
2017-09-05 18:13:22.323427: [debug] Found shared library libtinfo.so.5 in 'ldconfig -p' output
@(Stack/Setup.hs:561:29)
2017-09-05 18:13:22.323589: [debug] Did not find shared library libtinfo.so.6
@(Stack/Setup.hs:575:38)
2017-09-05 18:13:22.323663: [debug] Did not find shared library libncursesw.so.6
@(Stack/Setup.hs:575:38)
2017-09-05 18:13:22.323725: [debug] Found shared library libgmp.so.10 in 'ldconfig -p' output
@(Stack/Setup.hs:561:29)
2017-09-05 18:13:22.323795: [debug] Did not find shared library libgmp.so.3
@(Stack/Setup.hs:575:38)
2017-09-05 18:13:22.323846: [debug] Using standard GHC build
@(Stack/Setup.hs:613:9)
2017-09-05 18:13:22.324144: [debug] Getting global package database location
@(Stack/GhcPkg.hs:46:5)
2017-09-05 18:13:22.324321: [debug] Asking GHC for its version
@(Stack/Setup/Installed.hs:98:13)
2017-09-05 18:13:22.324438: [debug] Getting Cabal package version
@(Stack/GhcPkg.hs:185:5)
2017-09-05 18:13:22.324509: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.324932: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --numeric-version
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.325906: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.342697: [debug] Process finished in 18ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.352001: [debug] Process finished in 25ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.373818: [debug] Process finished in 47ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --numeric-version
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.374015: [debug] GHC version is: ghc-8.0.2
@(Stack/Setup/Installed.hs:102:13)
2017-09-05 18:13:22.374136: [debug] Resolving package entries
@(Stack/Setup.hs:252:5)
2017-09-05 18:13:22.374362: [debug] Trying to decode /home/foo/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.0.2/lts-9.3.cache
@(Data/Store/VersionTagged.hs:66:5)
2017-09-05 18:13:22.400517: [debug] Success decoding /home/foo/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.0.2/lts-9.3.cache
@(Data/Store/VersionTagged.hs:70:13)
2017-09-05 18:13:22.401300: [debug] Starting to execute command inside EnvConfig
@(Stack/Runners.hs:168:18)
2017-09-05 18:13:22.401519: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg list --simple-output
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.419844: [debug] Process finished in 18ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg list --simple-output
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.420053: [debug] Missing packages, performing installation
@(Stack/Script.hs:84:21)
2017-09-05 18:13:22.420143: [debug] Parsing the targets
@(Stack/Build/Target.hs:473:3)
2017-09-05 18:13:22.460835: [debug] Finding out which packages are already installed
@(Stack/Build/Installed.hs:60:5)
2017-09-05 18:13:22.461683: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.487589: [debug] Process finished in 25ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.488454: [debug] Ignoring package haskeline due to wanting version 0.7.4.0 instead of 0.7.3.0
@(Stack/Build/Installed.hs:190:5)
2017-09-05 18:13:22.488553: [debug] Ignoring package terminfo due to wanting version 0.4.1.0 instead of 0.4.0.2
@(Stack/Build/Installed.hs:190:5)
2017-09-05 18:13:22.488626: [debug] Ignoring package xhtml due to wanting version 3000.2.2 instead of 3000.2.1
@(Stack/Build/Installed.hs:190:5)
2017-09-05 18:13:22.488895: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb dump --expand-pkgroot
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.507026: [debug] Process finished in 17ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb dump --expand-pkgroot
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.507375: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/script/lts-9.3/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/pkgdb dump --expand-pkgroot
@(System/Process/Log.hs:37:3)
2017-09-05 18:13:22.525772: [debug] Process finished in 18ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/script/lts-9.3/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/pkgdb dump --expand-pkgroot
@(System/Process/Log.hs:44:3)
2017-09-05 18:13:22.526398: [debug] Constructing the build plan
@(Stack/Build/ConstructPlan.hs:179:5)
2017-09-05 18:13:22.527063: [debug] Trying to decode /home/foo/.stack/indices/Hackage/01-index.cache
@(Data/Store/VersionTagged.hs:66:5)
2017-09-05 18:13:22.650981: [debug] Success decoding /home/foo/.stack/indices/Hackage/01-index.cache
@(Data/Store/VersionTagged.hs:70:13)
2017-09-05 18:13:22.653824: [info] Didn't see ghc-8.0.2 in your package indices.
Updating and trying again.
@(Stack/Fetch.hs:357:33)
2017-09-05 18:13:22.655279: [info] Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
@(Stack/PackageIndex.hs:307:24)
2017-09-05 18:13:22.659140: [info] Downloading timestamp                                         
@(Stack/PackageIndex.hs:307:24)
2017-09-05 18:13:24.080026: [info] No updates to your package index were found                   
@(Stack/PackageIndex.hs:362:14)
Update complete                                                                                  
2017-09-05 18:13:27.790829: [debug] Trying to decode /home/foo/.stack/indices/Hackage/01-index.cache
@(Data/Store/VersionTagged.hs:66:5)
2017-09-05 18:13:27.990528: [debug] Success decoding /home/foo/.stack/indices/Hackage/01-index.cache
@(Data/Store/VersionTagged.hs:70:13)
The following package identifiers were not found in your indices: ghc-8.0.2
Possible candidates: ghc-8.2.1.

Success case

step 1.

stack script test.hs --resolver lts-9.3 --package ghc-paths --verbose
Version 1.5.1, Git revision 2b0392468a03174a7c5d317291c62452d771b055 x86_64 hpack-0.18.1
2017-09-05 18:15:02.972926: [debug] Ignoring config files
@(Stack/Config.hs:915:13)
2017-09-05 18:15:02.973516: [debug] Using resolver: lts-9.3 specified on command line
@(Stack/Config.hs:537:7)
2017-09-05 18:15:02.973588: [info] Using resolver: lts-9.3 specified on command line
@(Stack/Config.hs:628:17)
2017-09-05 18:15:02.973655: [debug] Decoding build plan from: /home/foo/.stack/build-plan/lts-9.3.yaml
@(Stack/Snapshot.hs:151:5)
2017-09-05 18:15:04.180276: [debug] Run process: /sbin/ldconfig -p
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.182259: [debug] Process finished in 1ms: /sbin/ldconfig -p
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.182457: [debug] Run process: /usr/bin/gcc -v
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.183728: [debug] Process finished in 1ms: /usr/bin/gcc -v
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.183838: [debug] PIE enabled
@(Stack/Setup.hs:585:17)
2017-09-05 18:15:04.183976: [debug] Found shared library libtinfo.so.5 in 'ldconfig -p' output
@(Stack/Setup.hs:561:29)
2017-09-05 18:15:04.184180: [debug] Did not find shared library libtinfo.so.6
@(Stack/Setup.hs:575:38)
2017-09-05 18:15:04.184270: [debug] Did not find shared library libncursesw.so.6
@(Stack/Setup.hs:575:38)
2017-09-05 18:15:04.184354: [debug] Found shared library libgmp.so.10 in 'ldconfig -p' output
@(Stack/Setup.hs:561:29)
2017-09-05 18:15:04.184446: [debug] Did not find shared library libgmp.so.3
@(Stack/Setup.hs:575:38)
2017-09-05 18:15:04.184524: [debug] Using standard GHC build
@(Stack/Setup.hs:613:9)
2017-09-05 18:15:04.184852: [debug] Getting global package database location
@(Stack/GhcPkg.hs:46:5)
2017-09-05 18:15:04.184990: [debug] Asking GHC for its version
@(Stack/Setup/Installed.hs:98:13)
2017-09-05 18:15:04.185118: [debug] Getting Cabal package version
@(Stack/GhcPkg.hs:185:5)
2017-09-05 18:15:04.185189: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.185575: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --numeric-version
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.189497: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.208970: [debug] Process finished in 22ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.231413: [debug] Process finished in 29ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.231731: [debug] Process finished in 46ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --numeric-version
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.231846: [debug] GHC version is: ghc-8.0.2
@(Stack/Setup/Installed.hs:102:13)
2017-09-05 18:15:04.231992: [debug] Resolving package entries
@(Stack/Setup.hs:252:5)
2017-09-05 18:15:04.232213: [debug] Trying to decode /home/foo/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.0.2/lts-9.3.cache
@(Data/Store/VersionTagged.hs:66:5)
2017-09-05 18:15:04.258664: [debug] Success decoding /home/foo/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.0.2/lts-9.3.cache
@(Data/Store/VersionTagged.hs:70:13)
2017-09-05 18:15:04.259391: [debug] Starting to execute command inside EnvConfig
@(Stack/Runners.hs:168:18)
2017-09-05 18:15:04.259593: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg list --simple-output
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.278507: [debug] Process finished in 18ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg list --simple-output
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.278649: [debug] Missing packages, performing installation
@(Stack/Script.hs:84:21)
2017-09-05 18:15:04.278764: [debug] Parsing the targets
@(Stack/Build/Target.hs:473:3)
2017-09-05 18:15:04.310866: [debug] Finding out which packages are already installed
@(Stack/Build/Installed.hs:60:5)
2017-09-05 18:15:04.311614: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.346677: [debug] Process finished in 34ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.347377: [debug] Ignoring package haskeline due to wanting version 0.7.4.0 instead of 0.7.3.0
@(Stack/Build/Installed.hs:190:5)
2017-09-05 18:15:04.347468: [debug] Ignoring package terminfo due to wanting version 0.4.1.0 instead of 0.4.0.2
@(Stack/Build/Installed.hs:190:5)
2017-09-05 18:15:04.347535: [debug] Ignoring package xhtml due to wanting version 3000.2.2 instead of 3000.2.1
@(Stack/Build/Installed.hs:190:5)
2017-09-05 18:15:04.347748: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb dump --expand-pkgroot
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.368349: [debug] Process finished in 20ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb dump --expand-pkgroot
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.368581: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/script/lts-9.3/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/pkgdb dump --expand-pkgroot
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:04.385803: [debug] Process finished in 17ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/script/lts-9.3/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/pkgdb dump --expand-pkgroot
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:04.386433: [debug] Constructing the build plan
@(Stack/Build/ConstructPlan.hs:179:5)
2017-09-05 18:15:04.387302: [debug] Trying to decode /home/foo/.stack/indices/Hackage/01-index.cache
@(Data/Store/VersionTagged.hs:66:5)
2017-09-05 18:15:04.535856: [debug] Success decoding /home/foo/.stack/indices/Hackage/01-index.cache
@(Data/Store/VersionTagged.hs:70:13)
2017-09-05 18:15:04.540159: [debug] Checking if we are going to build multiple executables with the same name
@(Stack/Build.hs:177:5)
2017-09-05 18:15:04.540262: [debug] Executing the build plan
@(Stack/Build/Execute.hs:487:5)
2017-09-05 18:15:04.558429: [debug] Creating process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-1.24.2.0 /home/foo/.stack/setup-exe-src/setup-mPHDZzAJ.hs /home/foo/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /home/foo/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2
@(System/Process/Log.hs:22:3)
[1 of 2] Compiling Main             ( /home/foo/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /home/foo/.stack/setup-exe-src/setup-mPHDZzAJ.o )
[2 of 2] Compiling StackSetupShim   ( /home/foo/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /home/foo/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
Linking /home/foo/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 ...
2017-09-05 18:15:08.144445: [debug] Getting global package database location
@(Stack/GhcPkg.hs:46:5)
2017-09-05 18:15:08.144627: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:08.163161: [debug] Process finished in 18ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:08.163848: [debug] Exception ignored when attempting to load /home/foo/.stack/precompiled/x86_64-linux/ghc-8.0.2/1.24.2.0/ghc-paths-0.1.0.9@sha256:d3f3470c7bd13b765891fb56b28d809cb7aeda0a78050679ae6f29b6705c46bf,656/SWXaDPn62wF2mi5c-wlXeEG1Td-bFCxHP1uj741nlPo=: /home/foo/.stack/precompiled/x86_64-linux/ghc-8.0.2/1.24.2.0/ghc-paths-0.1.0.9@sha256:d3f3470c7bd13b765891fb56b28d809cb7aeda0a78050679ae6f29b6705c46bf,656/SWXaDPn62wF2mi5c-wlXeEG1Td-bFCxHP1uj741nlPo=: openBinaryFile: does not exist (No such file or directory)
@(Data/Store/VersionTagged.hs:84:9)
2017-09-05 18:15:08.164431: [debug] Downloading /hackage.fpcomplete.com/package/ghc-paths-0.1.0.9.tar.gz
@(Network/HTTP/Download/Verified.hs:226:9)
2017-09-05 18:15:09.756666: [info] ghc-paths-0.1.0.9: download
@(Stack/Fetch.hs:525:32)
2017-09-05 18:15:09.759156: [debug] Exception ignored when attempting to load /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/stack-config-cache: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/stack-config-cache: openBinaryFile: does not exist (No such file or directory)
@(Data/Store/VersionTagged.hs:84:9)
2017-09-05 18:15:09.759328: [debug] Exception ignored when attempting to load /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/stack-cabal-mod: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/stack-cabal-mod: openBinaryFile: does not exist (No such file or directory)
@(Data/Store/VersionTagged.hs:84:9)
2017-09-05 18:15:09.759562: [info] ghc-paths-0.1.0.9: configure
@(Stack/Build/Execute.hs:838:23)
2017-09-05 18:15:09.760713: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-8.0.2 --make -odir /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup -hidir /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup -i -i. -clear-package-db -global-package-db -package-db=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb -package-db=/home/foo/.stack/script/lts-9.3/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/pkgdb -hide-all-packages -package-id=Cabal-1.24.2.0 -package-id=base-4.9.1.0 -package-id=directory-1.3.0.0 -optP-include -optP/tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup_macros.h /tmp/stack31298/ghc-paths-0.1.0.9/Setup.hs /home/foo/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup -threaded
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:13.436617: [debug] Process finished in 3675ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-8.0.2 --make -odir /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup -hidir /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup -i -i. -clear-package-db -global-package-db -package-db=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb -package-db=/home/foo/.stack/script/lts-9.3/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/pkgdb -hide-all-packages -package-id=Cabal-1.24.2.0 -package-id=base-4.9.1.0 -package-id=directory-1.3.0.0 -optP-include -optP/tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup_macros.h /tmp/stack31298/ghc-paths-0.1.0.9/Setup.hs /home/foo/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup -threaded
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:13.437039: [debug] Run process: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 configure --with-ghc=/home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --with-ghc-pkg=/home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb --libdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/lib --bindir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/bin --datadir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/share --libexecdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/libexec --sysconfdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/etc --docdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/doc/ghc-paths-0.1.0.9 --htmldir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/doc/ghc-paths-0.1.0.9 --haddockdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/doc/ghc-paths-0.1.0.9 --dependency=Cabal=Cabal-1.24.2.0 --dependency=base=base-4.9.1.0 --dependency=directory=directory-1.3.0.0
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:14.003558: [debug] Process finished in 566ms: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 configure --with-ghc=/home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --with-ghc-pkg=/home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb --libdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/lib --bindir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/bin --datadir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/share --libexecdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/libexec --sysconfdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/etc --docdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/doc/ghc-paths-0.1.0.9 --htmldir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/doc/ghc-paths-0.1.0.9 --haddockdir=/home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/doc/ghc-paths-0.1.0.9 --dependency=Cabal=Cabal-1.24.2.0 --dependency=base=base-4.9.1.0 --dependency=directory=directory-1.3.0.0
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:14.003874: [debug] Encoding /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/stack-config-cache
@(Data/Store/VersionTagged.hs:48:5)
2017-09-05 18:15:14.004236: [debug] Finished writing /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/stack-config-cache
@(Data/Store/VersionTagged.hs:53:5)
2017-09-05 18:15:14.004341: [debug] Encoding /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/stack-cabal-mod
@(Data/Store/VersionTagged.hs:48:5)
2017-09-05 18:15:14.004649: [debug] Finished writing /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/stack-cabal-mod
@(Data/Store/VersionTagged.hs:53:5)
2017-09-05 18:15:14.004799: [info] ghc-paths-0.1.0.9: build
@(Stack/Build/Execute.hs:838:23)
2017-09-05 18:15:14.005078: [debug] Run process: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:14.470439: [debug] Process finished in 465ms: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:14.470627: [info] ghc-paths-0.1.0.9: copy/register
@(Stack/Build/Execute.hs:838:23)
2017-09-05 18:15:14.470949: [debug] Run process: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 copy
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:14.485856: [debug] Process finished in 14ms: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 copy
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:14.486332: [debug] Run process: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 register
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:14.606404: [debug] Process finished in 119ms: /tmp/stack31298/ghc-paths-0.1.0.9/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 register
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:14.606903: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb describe --simple-output ghc-paths --expand-pkgroot
@(System/Process/Log.hs:37:3)
2017-09-05 18:15:14.627097: [debug] Process finished in 19ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/foo/.stack/snapshots/x86_64-linux/lts-9.3/8.0.2/pkgdb describe --simple-output ghc-paths --expand-pkgroot
@(System/Process/Log.hs:44:3)
2017-09-05 18:15:14.627936: [debug] Encoding /home/foo/.stack/precompiled/x86_64-linux/ghc-8.0.2/1.24.2.0/ghc-paths-0.1.0.9@sha256:d3f3470c7bd13b765891fb56b28d809cb7aeda0a78050679ae6f29b6705c46bf,656/SWXaDPn62wF2mi5c-wlXeEG1Td-bFCxHP1uj741nlPo=
@(Data/Store/VersionTagged.hs:48:5)
2017-09-05 18:15:14.628291: [debug] Finished writing /home/foo/.stack/precompiled/x86_64-linux/ghc-8.0.2/1.24.2.0/ghc-paths-0.1.0.9@sha256:d3f3470c7bd13b765891fb56b28d809cb7aeda0a78050679ae6f29b6705c46bf,656/SWXaDPn62wF2mi5c-wlXeEG1Td-bFCxHP1uj741nlPo=
@(Data/Store/VersionTagged.hs:53:5)
2017-09-05 18:15:14.631289: [debug] Encoding /home/foo/.stack/script/lts-9.3/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/flag-cache/ghc-paths-0.1.0.9-AhaDlGOsRAepox069XzG
@(Data/Store/VersionTagged.hs:48:5)
2017-09-05 18:15:14.631680: [debug] Finished writing /home/foo/.stack/script/lts-9.3/.stack-work/install/x86_64-linux/lts-9.3/8.0.2/flag-cache/ghc-paths-0.1.0.9-AhaDlGOsRAepox069XzG
@(Data/Store/VersionTagged.hs:53:5)
2017-09-05 18:15:14.631958: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/runghc -hide-all-packages -packagebase -packageghc-paths /home/foo/test.hs
@(System/Process/Log.hs:37:3)
test.hs: Prelude.undefined
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
  undefined, called at /home/foo/test.hs:4:8 in main:Main

step 2

$ stack script test.hs --resolver lts-9.3 --package ghc --package ghc-paths --verbose
Version 1.5.1, Git revision 2b0392468a03174a7c5d317291c62452d771b055 x86_64 hpack-0.18.1
2017-09-05 18:21:34.453142: [debug] Ignoring config files
@(Stack/Config.hs:915:13)
2017-09-05 18:21:34.453729: [debug] Using resolver: lts-9.3 specified on command line
@(Stack/Config.hs:537:7)
2017-09-05 18:21:34.453809: [info] Using resolver: lts-9.3 specified on command line
@(Stack/Config.hs:628:17)
2017-09-05 18:21:34.454004: [debug] Decoding build plan from: /home/foo/.stack/build-plan/lts-9.3.yaml
@(Stack/Snapshot.hs:151:5)
2017-09-05 18:21:35.689984: [debug] Run process: /sbin/ldconfig -p
@(System/Process/Log.hs:37:3)
2017-09-05 18:21:35.691721: [debug] Process finished in 1ms: /sbin/ldconfig -p
@(System/Process/Log.hs:44:3)
2017-09-05 18:21:35.691915: [debug] Run process: /usr/bin/gcc -v
@(System/Process/Log.hs:37:3)
2017-09-05 18:21:35.693237: [debug] Process finished in 1ms: /usr/bin/gcc -v
@(System/Process/Log.hs:44:3)
2017-09-05 18:21:35.693446: [debug] PIE enabled
@(Stack/Setup.hs:585:17)
2017-09-05 18:21:35.693588: [debug] Found shared library libtinfo.so.5 in 'ldconfig -p' output
@(Stack/Setup.hs:561:29)
2017-09-05 18:21:35.693751: [debug] Did not find shared library libtinfo.so.6
@(Stack/Setup.hs:575:38)
2017-09-05 18:21:35.693829: [debug] Did not find shared library libncursesw.so.6
@(Stack/Setup.hs:575:38)
2017-09-05 18:21:35.693889: [debug] Found shared library libgmp.so.10 in 'ldconfig -p' output
@(Stack/Setup.hs:561:29)
2017-09-05 18:21:35.693963: [debug] Did not find shared library libgmp.so.3
@(Stack/Setup.hs:575:38)
2017-09-05 18:21:35.694014: [debug] Using standard GHC build
@(Stack/Setup.hs:613:9)
2017-09-05 18:21:35.694326: [debug] Asking GHC for its version
@(Stack/Setup/Installed.hs:98:13)
2017-09-05 18:21:35.694490: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --numeric-version
@(System/Process/Log.hs:37:3)
2017-09-05 18:21:35.694868: [debug] Getting Cabal package version
@(Stack/GhcPkg.hs:185:5)
2017-09-05 18:21:35.695774: [debug] Getting global package database location
@(Stack/GhcPkg.hs:46:5)
2017-09-05 18:21:35.695850: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:37:3)
2017-09-05 18:21:35.696084: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:37:3)
2017-09-05 18:21:35.714060: [debug] Process finished in 18ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:44:3)
2017-09-05 18:21:35.727648: [debug] Process finished in 32ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --numeric-version
@(System/Process/Log.hs:44:3)
2017-09-05 18:21:35.727766: [debug] GHC version is: ghc-8.0.2
@(Stack/Setup/Installed.hs:102:13)
2017-09-05 18:21:35.731071: [debug] Process finished in 17ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:44:3)
2017-09-05 18:21:35.731359: [debug] Resolving package entries
@(Stack/Setup.hs:252:5)
2017-09-05 18:21:35.731510: [debug] Trying to decode /home/foo/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.0.2/lts-9.3.cache
@(Data/Store/VersionTagged.hs:66:5)
2017-09-05 18:21:35.757467: [debug] Success decoding /home/foo/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.0.2/lts-9.3.cache
@(Data/Store/VersionTagged.hs:70:13)
2017-09-05 18:21:35.758334: [debug] Starting to execute command inside EnvConfig
@(Stack/Runners.hs:168:18)
2017-09-05 18:21:35.758541: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg list --simple-output
@(System/Process/Log.hs:37:3)
2017-09-05 18:21:35.777333: [debug] Process finished in 18ms: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg list --simple-output
@(System/Process/Log.hs:44:3)
2017-09-05 18:21:35.777506: [debug] All packages already installed
@(Stack/Script.hs:82:22)
2017-09-05 18:21:35.777688: [debug] Run process: /home/foo/.stack/programs/x86_64-linux/ghc-8.0.2/bin/runghc -hide-all-packages -packagebase -packageghc -packageghc-paths /home/foo/test.hs
@(System/Process/Log.hs:37:3)
test.hs: Prelude.undefined
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
  undefined, called at /home/foo/test.hs:4:8 in main:Main

Stack version

$ stack --version
Version 1.5.1, Git revision 2b0392468a03174a7c5d317291c62452d771b055 x86_64 hpack-0.18.1

Method of installation

waddlaw commented 7 years ago

Is this a bug? Or is it just me?

decentral1se commented 7 years ago

Looks like a bug!? :bug:

I can reproduce this:

λ ~/ stack script Main.hs --resolver lts-9.3 --package ghc --package ghc-paths
Using resolver: lts-9.3 specified on command line
Didn't see ghc-8.0.2 in your package indices.
Updating and trying again.
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/                                 
Downloading timestamp                                                                            
No updates to your package index were found                                                      
Update complete                                                                                  
The following package identifiers were not found in your indices: ghc-8.0.2
Possible candidates: ghc-8.2.1.

The following did work though:

λ ~/ stack script Main.hs --resolver nightly-2017-09-06 --package ghc --package ghc-paths                                                                                 
Using resolver: nightly-2017-09-06 specified on command line
Downloaded nightly-2017-09-06 build plan.    
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.2.1.                                      
Installed GHC.                                                               
[1 of 2] Compiling Main             ( /home/lwm/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /home/lwm/.stack/setup-exe-src/setup-mPHDZzAJ.o )
[2 of 2] Compiling StackSetupShim   ( /home/lwm/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /home/lwm/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
Linking /home/lwm/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_2.0.0.2_ghc-8.2.1 ...
ghc-paths-0.1.0.9: download
ghc-paths-0.1.0.9: configure
ghc-paths-0.1.0.9: build
ghc-paths-0.1.0.9: copy/register
Main.hs: Prelude.undefined
CallStack (from HasCallStack):
  error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
  undefined, called at /home/lwm/Main.hs:4:8 in main:Main
waddlaw commented 7 years ago

@lwm thank you for reply.

I understand that ghc package version equal to GHC version why doesn't work using lts-9.3?

lts-9.3

nightly-2017-09-06

stack script Main.hs --resolver nightly-2017-09-06 --package ghc --package ghc-paths is working. But, stack script Main.hs --resolver ghc-8.2.1 --package ghc --package ghc-paths doesn't work. why?

$ stack script Main.hs --resolver ghc-8.2.1 --package ghc --package ghc-paths
Using resolver: ghc-8.2.1 specified on command line
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.2.1.                                      
Installed GHC.                                                                
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/                                 
Downloading root                                                                                 
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/                                 
Downloading timestamp                                                                            
Downloading snapshot                                                                             
Downloading mirrors                                                                              
Cannot update index (no local copy)                                                              
Downloading index                                                                                
Updated package index downloaded                                                                 
Update complete                                                                                  
Populated index cache.    
Local packages are not allowed when using the script command. Packages found:
- ghc-paths-0.1.0.9
snoyberg commented 5 years ago

I believe this problem occurs because the ghc package is a special global package and does not always exist correctly on Hackage. It's not the only package like this. More generally, some packages that ship with GHC are different from their versions on Hackage. We've made a number of improvements around this on master, and AFAICT this problem has been fixed there. Closing, please ping if you can still reproduce with Stack master.