Gtk# application crashes on OSX

lipalipa HRMember, Beta

Hi,

My application runs normally on Ubuntu and Windows (XP, 7, 8) and on OSX when started from Xamarin Studio. But when I start application from terminal or xterm on OSX, then I got:

[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Gtk.Dialog ---> System.DllNotFoundException: gtksharpglue-2
  at (wrapper managed-to-native) Gtk.Dialog:gtksharp_gtk_dialog_get_vbox_offset ()
  at Gtk.Dialog..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Gtk.MessageDialog..ctor (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, Boolean use_markup, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0 
  at Gtk.MessageDialog..ctor (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0 
  at IIT.Biznet.XSystem.GUI.IITMessageBox.Show (Gtk.Window parent, System.String message, MessageType type, ButtonsType buttons) [0x00000] in <filename unknown>:0 
  at IIT.Biznet.XSystem.GUI.IITMessageBox.ShowError (Gtk.Window parent, System.String message) [0x00000] in <filename unknown>:0 
  at bnfpos.MainClass.IITUnhandledException (System.Object sender, System.UnhandledExceptionEventArgs e) [0x00000] in <filename unknown>:0 
  at bnfpos.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0

I have tried to run this applicaton on OSX 10.6 and 10.7 with same result using mono 2.10.10, 2.10.11 and 2.10.12.

Posts

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    System.DllNotFoundException: gtksharpglue-2

    libgtksharpglue-2.dylib cannot be found. There are two plausible reasons for this:

    1. You're not exporting $DYLD_LIBRARY_PATH or $DYLD_FALLBACK_LIBRARY_PATH so that it can be found; and
    2. That library doesn't actually exist.

    Regarding (2) the correct library is libgtk-quartz-2.0.0.dylib, though you don't need to worry about that as gtk-sharp.dll.config1 provides the mapping:

    <dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-quartz-2.0.0.dylib"/>
    

    The problem is that libgtk-quartz-2.0.0.dylib can't be found, because it's installed to /Library/Frameworks/Mono.framework/Libraries, not /usr/lib (or anything global).

    To launch your app, you need to provide a script2 which contains:

    export DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib:/lib:/usr/lib
    

    1. See /Library/Frameworks/Mono.framework/Libraries/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll.config ↩︎

    2. Or wrapper executable. ↩︎

  • Really great solution! Thank you so much!

  • Xamarin_SrikanthXamarin_Srikanth Member ✭✭

    Mono error on Ubuntu16/CentOS7: System.DllNotFoundException: gtksharpglue-2

Sign In or Register to comment.