
On Sat, 2007-07-28 at 12:16 +0200, Thorkil Naur wrote:
Hello,
(From the archives:)
[Haskell] ANNOUNCE: Gtk2Hs version 0.9.12 released Duncan Coutts duncan.coutts at worc.ox.ac.uk Fri Jul 27 15:20:57 EDT 2007
Gtk2Hs - A GUI Library for Haskell based on Gtk+
Version 0.9.12 is now available from: ... Duncan (on behalf of the Gtk2Hs team)
Following the advice of nominolo_ from #haskell yesterday, I added -L/opt/local/lib to my ghc command and then the helloworld demo of Gtk2Hs worked. The problem seems to be the order in which the two library directories /usr/X11R6/lib and /opt/local/lib appear on the link command: For the GTK+ example that worked, /opt/local/lib comes first. For the Gtk2Hs demo that failed, /usr/X11R6/lib comes first.
That's very interesting.
I compared these two directories and found these common files:
[...]
Since some of these (Xrender, fontconfig, and freetype) are actually used in GTK+ (and therefore also Gtk2Hs) applications, there is clearly a potential for conflict here.
Certainly and if I recall correctly, the gdb backtrace you got showed that it was failing in a call to a fontconfig function.
In any case, adding -L/opt/local/lib to the ghc command makes this library appear before /usr/X11R6/lib on the link command and this seems to solve the problem. Subsequently, I have tried a handful of the other demos, and as far as they didn't require something that wasn't available (glade, for example), they seemed to work.
So what I wonder is how we can make this work reliably. We use the flags that pkg-config tells us to use, I'd rather not add platform-specific hacks if we can get the pkg-config settings fixed. So I presume when you run pkg-config --libs gtk+-2.0 it does not list -L/opt/local/lib, or if it does it lists it after -L/usr/X11R6/lib. Is that the case? Where did you install Gtk+ from? DarwinPorts or somewhere else? If it's the pkg-config setting for Gtk+ that we think are wrong then we should get that fixed upstream in the package that installed Gtk+. Duncan