0

I'm trying to install haskell-chart from here (github), I clone it, install stack, ran stack setup (it installs GHC successfully), but then I ran make that fails with the messages:

...
Chart-cairo-1.8: copy/register
Chart-diagrams-1.8: copy/register
Progress: 4/6
--  While building package gtk-0.14.2 using:
      /tmp/stack4807/gtk-0.14.2/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
...

[ 22 of 209] Compiling Graphics.UI.Gtk.Embedding.Plug ( .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Graphics/UI/Gtk/Embedding/Plug.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Graphics/UI/Gtk/Embedding/Plug.o )

    /tmp/stack4807/gtk-0.14.2/Graphics/UI/Gtk/Embedding/Plug.chs:120:6:
        Couldn't match expected type ‘CUInt’
                    with actual type ‘Maybe DrawWindow’
        In the first argument of ‘gtk_plug_new’, namely...

Stack version is 1.1.2 x86_64 hpack-0.14.1, LTS Haskell 5.18 (ghc-7.10.3). What can I do with this errors?

E. Nerush
  • 69
  • 7
  • Have you tried it with a more recent LTS resolver? – leftaroundabout Sep 03 '16 at 00:31
  • I have tried lts-3.22, that [should](https://www.stackage.org/lts-3.22/docs) use gtk-0.13.9, but get the same errors about gtk-0.14.2. I new in haskell and stack but stack with lts-3.22 asked me for another version of ghc (that means that stack really uses lts-3.22). – E. Nerush Sep 04 '16 at 09:16
  • More _recent_ resolver conflicts with requirements of haskell-chart dependencies. – E. Nerush Sep 04 '16 at 09:19

3 Answers3

2

In order to build haskell-chart from github sources on linux one should replace in stack.yaml

flags:
    gtk:
        have-quartz-gtk: true

with

flags: {}

because Linux don't use Quartz flag have-quartz-gtk, and Quartz is not needed to build gtk (Windows also do not use Quartz).

leftaroundabout
  • 117,950
  • 5
  • 174
  • 319
E. Nerush
  • 69
  • 7
  • thanks for the answer. I added it to the [github issue](https://github.com/timbod7/haskell-chart/issues/163#issuecomment-318504387) – palik Jul 28 '17 at 13:35
0

Using brew I upgraded gtk+ from version 2.24.25 to 2.24.30 and installed the latest version of XQuartz (version 2.7.9 - I couldn't determine which version I had originally installed.)

With these changes I was able to successfully build the project with stack build.

Specific commands:

$ brew cask install xquartz --force
$ brew upgrade gtk
ErikR
  • 51,541
  • 9
  • 73
  • 124
0

Note that you don't actually have to use gtk. There are two rendering backend for the chart library - one based upon cairo from gtk2hs the other on the diagrams library. The cairo backend is significantly faster, whereas the diagrams backend is pure haskell, and hence is easier to build.

By default, both backends are built, but you can build just the core library and the diagrams backend with:

stack build ./chart ./chart-diagrams

timbod
  • 791
  • 5
  • 16
  • Actually, I'm using _cairo_ now for PDF output. I follow your [previous suggestion](https://github.com/timbod7/haskell-chart/issues/138) and make my figures as a "package" with its own stack.yaml and cabal files. I see now that I don't have to use gtk but I just wanted to look inside the source code, maybe make some changes etc. and learn Haskell by this. – E. Nerush Oct 26 '16 at 13:24