Sunday, January 7, 2018

Cabal install of wxHaskell CBool Error

So recently, I have been trying to dive back into programming with a little more oomph than a one-off project. I figured setting up a GUI along side would help keep me motivated. Now my current computer is an older Mac Book Pro because it is one of the few laptops in the house with a working battery. After diving around a large amount of fluff without any real substance, I decided going with wxHaskell would be the better choice. So I made sure wx was installed and did a cabal install wx, and wouldn't you know it that it failed.

src/haskell/Graphics/UI/WXCore/WxcTypes.hs:752:20: error:
    Ambiguous occurrence ‘CBool’
    It could refer to either ‘Foreign.C.CBool’,
                             imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
                             (and originally defined in ‘Foreign.C.Types’)
                          or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
                             defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
    |
752 | toCBool :: Bool -> CBool
    |                    ^^^^^

src/haskell/Graphics/UI/WXCore/WxcTypes.hs:755:22: error:
    Ambiguous occurrence ‘CBool’
    It could refer to either ‘Foreign.C.CBool’,
                             imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
                             (and originally defined in ‘Foreign.C.Types’)
                          or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
                             defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
    |
755 | withBoolResult :: IO CBool -> IO Bool
    |                      ^^^^^

src/haskell/Graphics/UI/WXCore/WxcTypes.hs:760:14: error:
    Ambiguous occurrence ‘CBool’
    It could refer to either ‘Foreign.C.CBool’,
                             imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
                             (and originally defined in ‘Foreign.C.Types’)
                          or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
                             defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
    |
760 | fromCBool :: CBool -> Bool
    |              ^^^^^

src/haskell/Graphics/UI/WXCore/WxcTypes.hs:763:55: error:
    Ambiguous occurrence ‘CBool’
    It could refer to either ‘Foreign.C.CBool’,
                             imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
                             (and originally defined in ‘Foreign.C.Types’)
                          or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
                             defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
    |
763 | foreign import ccall "intToBool" intToCBool :: Int -> CBool
    |                                                       ^^^^^

src/haskell/Graphics/UI/WXCore/WxcTypes.hs:764:48: error:
    Ambiguous occurrence ‘CBool’
    It could refer to either ‘Foreign.C.CBool’,
                             imported from ‘Foreign.C’ at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:126:1-16
                             (and originally defined in ‘Foreign.C.Types’)
                          or ‘Graphics.UI.WXCore.WxcTypes.CBool’,
                             defined at src/haskell/Graphics/UI/WXCore/WxcTypes.hs:750:1
    |
764 | foreign import ccall "boolToInt" cboolToInt :: CBool -> Int
    |                                                ^^^^^
cabal: Leaving directory '/var/folders/8_/gbh6jvpj5dng4lmty_f9bjwh0000gn/T/cabal-tmp-50540/wxcore-0.92.3.0'
cabal: Error: some packages failed to install:
wx-0.92.3.0-GsmnFZQfuQrJCt8TV3hj5w depends on wx-0.92.3.0 which failed to
install.
wxcore-0.92.3.0-Cn2phmaLu563t5S6tEBzjw failed during the building phase. The
exception was:
ExitFailure 1

So with that big mess, it was time to hunt for what to do. With any luck this will be fixed soon because I generally have very little idea of what I'm doing. So the first step was to see if there was an alternative without manual intervention. Nope. So, I downloaded the package that was having the problem.

https://hackage.haskell.org/package/wxcore

Then we extract and open up src/haskell/Graphics/UI/WXCore/WxcTypes.hs and edit line 127 to

import Foreign.C hiding (CBool)

Save the file, open up a terminal. Navigate to the wxcore-0.92.3.0 folder and run

cabal install

After it hopefully succeeds, which it did for me, just simply

cabal install wx

I hope this helps anyone that needs and that the need doesn't last too long. I came across someone mentioning this fix on Stack overflow I think, but I can't find the link to it and don't plan to search too hard for it.


Tag Cloud

.NET (2) A+ (5) ad ds (1) addon (4) Android (4) anonymous functions (1) application (9) arduino (1) artificial intelligence (1) backup (1) bash (6) camera (2) certifications (3) comptia (5) css (2) customize (11) encryption (3) error (13) exploit (5) ftp (1) funny (4) gadget (4) games (3) GUI (5) hardware (16) haskell (6) help (14) HTML (3) imaging (2) irc (1) it (1) java (2) javascript (13) jobs (1) Linux (19) lua (1) Mac (4) malware (1) math (6) msp (1) network (13) perl (2) php (3) plugin (2) powershell (8) privacy (2) programming (24) python (10) radio (2) regex (3) repair (2) security (16) sound (2) speakers (2) ssh (1) story (5) Techs from the Crypt (5) telnet (1) tools (13) troubleshooting (11) tutorial (9) Ubuntu (4) Unix (2) virtualization (2) web design (6) Windows (16) world of warcraft (1) wow (1) wx (1)