[Haskell-cafe] Howto debug erros occuring just by linking to non-Haskell libraries

Mads Lindstrøm mads_lindstroem at yahoo.dk
Sun Feb 1 13:40:05 EST 2009


Hi Haskeleers

I am trying to track down the cause of an error occurring in the Linux
version of wxHaskell. The error occurs before the main function is
executed. That is, it occurs if one imports the wxHaskell libraries, and
it occurs even if one do not execute any wxHaskell function.
Specifically, GLib complains that a initialization-function has not been
called.

My guess is, that it has something to do with the wxWidgets (and gtk or
glib) libraries wxHaskell links to.

Some people have suggested it may be an error in the way GHC links with
C libraries. But that is all guesswork, I would need something more
solid if I were to file GHC bugreport.

Here is a simple Haskell program to illustrate the problem:

  module Main where

  import Graphics.UI.WX

  main = print "sdfjkl"

and when we compile and execute this program we get:

  (process:13986): GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed, use IA__g_type_init() prior to this function
  
  (process:13986): Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion `GDK_IS_DISPLAY (display)' failed
  
  (process:13986): GLib-GObject-CRITICAL **: gtype.c:2240: initialization assertion failed, use IA__g_type_init() prior to this function
  
  (process:13986): Gdk-CRITICAL **: gdk_cursor_new_for_display: assertion `GDK_IS_DISPLAY (display)' failed
  "sdfjkl"

So even if I do not call any wxHaskell functions, just by linking to
wxHaskell, I get these errors.

As Jeroen Janssen reports here
http://www.mail-archive.com/wxhaskell-users@lists.sourceforge.net/msg00540.html , he is experiencing the same error, but his wxPython programs works. Thus, wxHaskell (or GHC or ...) must do something different.

Could this error be related to the order which external libraries are
loaded in? If so, do anybody know how to specify the load order?

Can anybody help med with a good approach for debugging this error?


Greetings,

Mads Lindstrøm





More information about the Haskell-Cafe mailing list