Haskell stack memo
In some cases, stack says that precompiled packages are broken. This problem will solve following steps.
- unregister package by ghc-pkg
- delete precompiled package files of stack
In following instruction, the target package name will denote as “package”. In stack message, the pakcage name is denote with version number, like “package-1.0.1”.
delete package
stack exec -- ghc-pkg unregister --force package
check deletion
stack exec -- ghc-pkg list | grep package
When there are several version of GHC, these commands may not work well. Then do below.
- find ghc-pkg manageing the target pakcage
- ex : ~/.stack/programs/x86_64-osx/ghc-7.10.2/bin/ghc-pkg
- $$ $$
- find database file
- ex : ~/.stack/snapshots/x86_64-osx/lts-3.1/7.10.2/pkgdb
- $$ $$
- delete package
- do > $$ghcpkg –package-db $$pkgdb unregister –force package
- check deletion
- do > $$ghcpkg –package-db $$pkgdb list | grep package
find ~/.stack/precompiled -type d -name package-* | xargs rm -rf
Do “stack build”, “stack install …” or something. You may see that stack recompile the target pakcages.