Missing dependencies for chart-cairo on linux mint 17

598 views Asked by At

I'm struggling to install GTK / gtk2hs binding on Linux Mint 17.

The first time I encountered this problem was when I tried to get glade support in Haskell.

There were the same problems but it was purely for fun so I let it be.

This time I was trying to visualize a graph with Haskell Chart.

The problem occured in the forth step cabal install chart-cairo

I'm using GHC version 7.6.3, cabal version 1.16.0.2, gtk2hs-buildtools version 0.12.4-2ubuntu1 (from the package manager), gtk2hsC2hs version 0.13.6 (this is where glade needs to have >=0.13.8, but I can't find a newer version)

Things I've tried so far:

  1. After downloading the gtk2hs-buildtools from the package manager I updated cabal and installed the tools from the command line

  2. Added the "$HOME/.cabal/bin" to the front of $PATH (after that gtk installed correctly)

  3. cabal install chart-cairo gets me this error message

    Resolving dependencies...    
    [1 of 2] Compiling SetupWrapper     ( /tmp/cairo-0.13.0.2-19862/cairo-0.13.0.2/SetupWrapper.hs, /tmp/cairo-0.13.0.2-19862/cairo-0.13.0.2/dist/setup/SetupWrapper.o )    
    [2 of 2] Compiling Main             ( /tmp/cairo-0.13.0.2-19862/cairo-0.13.0.2/dist/setup/setup.hs, /tmp/cairo-0.13.0.2-19862/cairo-0.13.0.2/dist/setup/Main.o )    
    Linking /tmp/cairo-0.13.0.2-19862/cairo-0.13.0.2/dist/setup/setup ...    
    [1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )    
    [2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )    
    Linking dist/setup-wrapper/setup ...    
    Configuring cairo-0.13.0.2...    
    Building cairo-0.13.0.2...    
    Preprocessing library cairo-0.13.0.2...    
    [ 1 of 18] Compiling Graphics.Rendering.Cairo.Matrix ( dist/build/Graphics/Rendering/Cairo/Matrix.hs, dist/build/Graphics/Rendering/Cairo/Matrix.o )    
    [ 2 of 18] Compiling Graphics.Rendering.Cairo.Types ( dist/build/Graphics/Rendering/Cairo/Types.hs, dist/build/Graphics/Rendering/Cairo/Types.o )    
    [ 3 of 18] Compiling Graphics.Rendering.Cairo.Internal.Utilities ( dist/build/Graphics/Rendering/Cairo/Internal/Utilities.hs, dist/build/Graphics/Rendering/Cairo/Internal/Utilities.o )    
    
    Graphics/Rendering/Cairo/Internal/Utilities.chs:24:42:    
        Module `Data.Text.Foreign' does not export `withCStringLen'    
    Failed to install cairo-0.13.0.2    
    cabal: Error: some packages failed to install:    
        Chart-cairo-1.3.2 depends on cairo-0.13.0.2 which failed to install.    
        cairo-0.13.0.2 failed during the building phase. The exception was:    
        ExitFailure 1    
    
  4. pkg-config cairo --modversion tells me I have the version 1.13.1 (which is newer than 0.13.0.2?)

3

There are 3 answers

6
jamshidh On BEST ANSWER

I just tried it myself, and hit some snags that I was able to overcome.... Perhaps you are having the same problem.

For some reason, some dependencies would not automatically install. It is easy to install them by hand though. Try this:

cabal install alex
cabal install gtk2hs-buildtools
cabal install cairo
cabal install chart-cairo

In general, if you see an error message in your cabal output like the following line in your post

Failed to install cairo-0.13.0.2   

it is a good idea to try the install manually. Although dependencies are supposed to be worked out, I've run into many cases where they don't (I think it might have to do with cabal installing command line tools, but have never looked into it fully). In this particular case, that is what I did, but I had to go up the chain 4 times....

0
Hamish Mackenzie On
  1. An old version of text is being used (also causing cabal to choose the old version of cairo with bad build-deps). Try adding --constraint='cairo>=0.13.0.5' to your cabal install. That should also force cabal to choose a newer version of text.

  2. pkg-config cairo --modversion gives the version of the actual cairo library. 0.13.0.2 is the version of the Gtk2Hs haskell package that wraps cairo (actual cairo version wrapped depends what is installed)

0
AsymLabs On

I encountered the same issue. This is a late reply but a good resource for this problem is found here. On my Debian system (Linux Mint) I found that doing:

sudo apt-get install libghc-gtk-dev

solved the problem. But the link provides installation advice for several Linux based systems as well as Windows, BSD and Mac.