Can cabal not un-install packages?
cabal help
shows thers isnot "uninstall" option.
then what's the best way to uninstall the packages installed by cabal ?
% cabal update
% cabal install mighttpd2
mighttpd2 is installed successfully. However the ghc-pkg cannot find & unregister it:
% ghc-pkg list | grep -i might
% ghc-pkg unregister mighttpd2
ghc-pkg: cannot find package mighttpd2
Sincerely!
>find .cabal | g开发者_Go百科rep -i mighttp
.cabal/share/doc/mighttpd2-2.3.3
.cabal/share/doc/mighttpd2-2.3.3/LICENSE
.cabal/share/mighttpd2-2.3.3
.cabal/share/mighttpd2-2.3.3/sample.conf
.cabal/share/mighttpd2-2.3.3/sample.route
.cabal/packages/hackage.haskell.org/mighttpd2
.cabal/packages/hackage.haskell.org/mighttpd2/2.3.3
.cabal/packages/hackage.haskell.org/mighttpd2/2.3.3/mighttpd2-2.3.3.tar.gz
>ghc-pkg list | grep -i package\.conf
/usr/local/lib/ghc-7.0.3/package.conf.d:
/home/sw2wolf/.ghc/i386-freebsd-7.0.3/package.conf.d:
So ".cabal/packages/hackage.haskell.org" cannot be seen by ghc-pkg.
you might not have the Cabal path as part of your GHC path.
step 1
First, try to find out what your GHC package path is,
ghc-pkg list
# displays stuff like "/home/username/.../package.conf.d"
then, make sure the one Cabal is writing to is active. For me, Cabal adds packages to
/home/username/.ghc/x86_64-linux-7.0.4/package.conf.d
step 2
If there is no such directory on your system, see what Cabal's writing.
strace -f -o trace.txt cabal install mighttpd2
grep "package\.cache" trace.txt
then add the package path to this system environment variable
export GHC_PACKAGE_PATH=NEWPATH:/usr/local/lib/ghc-7.0.3/package.conf.d
try again, if it doesn't work proceed to step 3
step 3
look in that directory and see if there's a file like
mighthttpd2-version-LONGHASHCODE.conf
if it's there, then you probably need to recache
ghc-pkg recache --user
The GHC package system is not used for executables, and the mighttpd2
package only builds executables. To uninstall it, simply remove the two executables (mighty
and mkindex
) and the two data files (sample.conf
and sample.route
) listed in the package's cabal file. You can find which directories these files were installed to by perusing cabal's config file in ~/.cabal/config
.
精彩评论