Adam Głowacki
Adam Głowacki

Reputation: 137

Why compiling GTK (gi-gtk) application with haskell/stack is not reproducible?

I have created an app that uses GTK via gi-gtk in Haskell, dependencies managed with stack (lts-9.2). I compiled it successfully on Fedora 26. Then I have successfully executed the binary on other Linux distributions as well.

After a while I wanted to compile the same application on other system (elementary OS). I cloned the repository, called stack setup in the project directory and then stack build. It complained about some missing dependencies so I installed them and finally, I got an error from GHC about my own code:

Not in scope: 'GTK.popoverPopdown'
Perhaps you meant one of these:
  'GTK.popoverModal' (imported from GI.Gtk)
  'GTK.popoverPosition' (imported from GI.Gtk)
Module 'GI.Gtk' does not export 'popoverPopdown'.

Why? As I look at the documentation (https://hackage.haskell.org/package/gi-gtk-3.0.17/docs/GI-Gtk-Objects-Popover.html) there is popoverPopdown but nothing like popoverModal or popoverPosition.

Then I switched to another machine with another Linux distribution (Ubuntu Studio) and got the same error. Finally I took a machine with Fedora 27, did the same and got another error (also inside my app code):

Couldn't match expected type 'Maybe b1'
            with actual type 'GTK.Image'
In the second argument of 'GTK.buttonSetImage', namely 'icon'
In a stmt of a 'do' block: btn `GTK.buttonSetImage` icon

Again the documentation (https://hackage.haskell.org/package/gi-gtk-3.0.17/docs/GI-Gtk-Objects-Button.html#g:26) claims something different than GHC. Could somebody explain to me what's going on?

Answering to one of the comments: Below are what GTK versions are installed in the mentioned systems. Nonetheless GHC complains about Haskell code and I thought all the Haskell code is downloaded from Stackage. Are any dependencies generated locally on my system during stack build?

Upvotes: 1

Views: 457

Answers (1)

Adam Głowacki
Adam Głowacki

Reputation: 137

Ok, now I can see that (contrary to what I had thought before) Haskell-GTK bindings are generated on my computer, during building gi-gtk package. Indeed in GTK v3.18 there was nothing like gtk_popover_popdown, that's why Haskell function popoverPopdown was not generated at all. And I guess that it's similar with gtk_button_set_image.

Now I need to remember that this Stackage/Hackage package is of a different kind. I must track the precise version of GTK I am building my application with and not rely on stack in this matter.

Upvotes: 2

Related Questions