Search code examples
haskellreactive-programmingfrp

installing reactive banana-wx or wx on redhat based linux with ghc 7.0.4


hi i'm trying to install, (without having to update or install the latest compiler),reactive-banana-wx and one of the requirement's are failing

cabal install reactive-banana-wx

and heres the error

Configuring wxc-0.90.0.4...
setup: failed
cabal: Error: some packages failed to install:
reactive-banana-wx-0.6.0.1 depends on wxc-0.90.0.4 which failed to install.
wx-0.90.0.1 depends on wxc-0.90.0.4 which failed to install.
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1
wxcore-0.90.0.3 depends on wxc-0.90.0.4 which failed to install

when i try to cabal install wxcore ,wx or wxc they all say failed and point towards wxc being required.

here's the error

cabal install wxc
Resolving dependencies...
[1 of 1] Compiling Main             ( /tmp/wxc-0.90.0.419410/wxc-0.90.0.4/Setup.hs, /tmp/wxc-0.90.0.419410/wxc-0.90.0.4/dist/setup/Main.o )
Linking /tmp/wxc-0.90.0.419410/wxc-0.90.0.4/dist/setup/setup ...
Configuring wxc-0.90.0.4...
setup: failed
cabal: Error: some packages failed to install:
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1

here's my compiler info if it would be useful

ghc -v
Glasgow Haskell Compiler, Version 7.0.4, for Haskell 98, stage 2 booted by GHC version 7.0.4

Solution

  • I've got the same error trying to install phooey with ghc 7.4.1 on Debian tonight. The reason is a bug in the package wxc-0.90.0.4 and it should affect all wxHaskell-based packages. You can fix it, there is no need to downgrade your wxc package...

    The easiest way to reproduce it is to do

    cabal install wxc 
    

    or

    cabal install glade
    

    It might be a good idea to make sure that all prerequisites are in place, before you do it. wxc depends on a number of cabal and Linux packages and all of them should be installed and compiled... I did it in the most stupid way possible, just by running

    cabal install wxc 
    

    and reading error messages which it spills out. This sweetie usually tells you what it wants... For instance, if it complains about cabal package x, just do cabal install x. If it complains about Linux package y, then use your Linux package manager and install the development version of this package, which is called normally lib<y>-dev in Debian. So, for instance, if

    cabal install wxc 
    

    gives you an error saying that package gtk+2.0 is missing, you want to do

    apt-get install libgtk2.0-dev
    

    The same story with cairo, glade2 and other GTK-related libraries

    When you are green with all prerequisites, you want to install wxWidgets-2.9, which is currently in the Development stage... so, it doesn't have any binaries for Linux and you should build it yourself. Download the source code from wxWidgets website and build it. It is pretty easy to do, just:

    • untar/unzip the source code to your favorite directory
    • run ./config
    • run ./make

    If you are on wxc-0.90.0.4, at this moment you should encounter our little bug... To keep the long story short, it is in the file eljpen.cpp, which you can find in

    ~/.cabal/packages/hackage.haskell.org/wxc/0.90.0.4/wxc-0.90.0.4.tar.gz
    

    Open the archive, go to the line 159 in the file and replace *_ref = NULL; with _ref = NULL or anything else what makes more sense. Then recreate the archive in the same place with the fixed eljpen.cpp file in it.

    • run ./make

    It should work now.

    • run sudo make install (normally, you should have root privileges to insatll wxWidgets library...).

    after it is done try to do

    cabal install wx
    

    again. It should be working now. I guess, after that you can enjoy your reactive-banana-wx, wxHaskell, phooey, etc.

    PS http://sourceforge.net/tracker/index.php?func=detail&aid=3576397&group_id=73133&atid=536845. Why didn't I find it earlier? :/