Search code examples
cabalcabal-installwxhaskell

wxHaskell not find module `Distribution.Compat.Exception'


I am trying install wxhaskell on ubuntu (and I have already installed wxwidget and it works well in codeblock)

I run cabal install wxc in terminal

and here is output

/tmp/wxc-0.92.1.1-2711/wxc-0.92.1.1/Setup.hs:25:8:
    Could not find module Distribution.Compat.Exception
    It is a member of the hidden package Cabal-1.22.5.0.
    it is a hidden module in the package Cabal-1.16.0
    Use -v to see a list of the files searched for.
Failed to install wxc-0.92.1.1
cabal: Error: some packages failed to install:
wxc-0.92.1.1 failed during the configure step. The exception was:
ExitFailure 1

actually, I can find Distribution.Compat.Exception and I tried sudo ghc-pkg expose Cabal-1.16.0
sudo ghc-pkg expose Cabal-1.22.5.0 but nothing changed

someone help me out, great thanks!


Solution

  • If you are using ubuntu I think I have a solution. If you install GHC in ubuntu via "apt-get install ghc", all ghc packages are installed in /usr/lib/ghc/xyz. If you have installed ghc manually, not with a package manager, I don't know a solution.

    Try this:

    sudo cabal install cabal-install --global
    

    Then do all the wxHaskell specific cabal installs the same way. So:

    sudo cabal install wxdirect --global
    sudo cabal install wxc --global
    ...
    

    If this doesn't work, try this:

    rm -rf ~/.ghc