Search code examples
haskellchartscairogtk2hs

Missing dependencies for chart-cairo on linux mint 17


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?)


Solution

  • 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....