Bug 4544 - System.DllNotFoundException: glibsharpglue-2
Summary: System.DllNotFoundException: glibsharpglue-2
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: packaging ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Alexis Christoforides
URL:
Depends on:
Blocks:
 
Reported: 2012-04-19 23:05 UTC by Chip
Modified: 2016-06-08 14:35 UTC (History)
9 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
hello.cs from website (260 bytes, application/octet-stream)
2012-04-19 23:05 UTC, Chip
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Chip 2012-04-19 23:05:38 UTC
Created attachment 1710 [details]
hello.cs from website

I directly copied the code from the getting started help page under the GTK section. 
When I followed the commands exactly I received an error. 
my console window looks like: 

 chip-snyders-macbook-pro:Desktop Chip$ gmcs hello.cs -pkg:gtk-sharp-2.0
chip-snyders-macbook-pro:Desktop Chip$ mono hello.exe

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Gtk.Application ---> System.DllNotFoundException: glibsharpglue-2
  at (wrapper managed-to-native) GLib.Thread:glibsharp_g_thread_supported ()
  at GLib.Thread.get_Supported () [0x00000] in <filename unknown>:0 
  at Gtk.Application..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Hello.Main () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for Gtk.Application ---> System.DllNotFoundException: glibsharpglue-2
  at (wrapper managed-to-native) GLib.Thread:glibsharp_g_thread_supported ()
  at GLib.Thread.get_Supported () [0x00000] in <filename unknown>:0 
  at Gtk.Application..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Hello.Main () [0x00000] in <filename unknown>:0 
chip-snyders-macbook-pro:Desktop Chip$
Comment 1 Marek Habersack 2012-04-20 04:18:35 UTC
Looks like invalid Mono installation. Try to download a new version of Mono DMG and reinstall it.

-> gtk#
Comment 2 Duncan Mak 2012-04-20 12:39:42 UTC
You can also try this DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib mono hello.exe
Comment 3 Joseph Hill 2012-04-21 09:09:32 UTC
Setting that environment variable still does not allow the program to run on a stock 2.10.9 installation.

The application runs fine from MonoDevelop.  Are we missing some other environment variable set up in our installation?
Comment 4 Mikayla Hutchinson [MSFT] 2012-04-23 08:48:51 UTC
This is a perennial problem that's never been fixed.

Probably Mono.framework should use absolute paths in its dllmaps. The installer shouldn't be modifying system env vars.
Comment 5 donsyme 2013-11-05 18:59:22 UTC
Any chance this could be fixed?  People are getting interested in using F# interactive on OSX more and more, including some Gtk programming. 

I know the workaround here: http://stackoverflow.com/questions/13885454/mono-on-osx-couldnt-find-gtksharpglue-2-dll. However fixing this properly would be very useful.
Comment 6 Rodrigo Kumpera 2014-01-17 18:20:39 UTC
Duncan,

During packaging, we should include in the dllmap all libraries the assemblies we ship pinvoke into.
Comment 7 Matthew L Daniel 2014-09-03 17:45:21 UTC
I see Rodrigo's comment, but I can report first-hand that MonoFramework-MDK-3.6.0.macos10.xamarin.x86.pkg that was just downloaded 30 minutes ago still exhibits this problem. I am on OS X 10.9.4

Per the answer by user Fabian at the bottom, I updated my .../etc/mono/config file to correctly list the Gtk (and friends) dllmap entries and afterward the Gtk example on http://www.mono-project.com/docs/getting-started/mono-basics/ started to work.

I was never able to get the WinForms one to display anything, although it did compile and "run", just with no GUI component on-screen.

Here are the entries I added, constructed through the use of /usr/bin/find and /usr/bin/sed:

<dllmap os="osx" dll="glibsharpglue-2" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libglibsharpglue-2.so" />
<dllmap os="osx" dll="gthread-2.0.0" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgthread-2.0.0.dylib" />
<dllmap os="osx" dll="gthread-2.0" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgthread-2.0.dylib" />
<dllmap os="osx" dll="gthread-2.0.0" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgthread-2.0.0.dylib" />
<dllmap os="osx" dll="gthread-2.0" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgthread-2.0.dylib" />
<dllmap os="osx" dll="glib-2.0.0" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libglib-2.0.0.dylib" />
<dllmap os="osx" dll="glib-2.0" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libglib-2.0.dylib" />
<dllmap os="osx" dll="glibsharpglue-2" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libglibsharpglue-2.so" />
<dllmap os="osx" dll="gobject-2.0.0" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgobject-2.0.0.dylib" />
<dllmap os="osx" dll="gobject-2.0" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgobject-2.0.dylib" />
<dllmap os="osx" dll="gtk-quartz-2.0.0"
target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgtk-quartz-2.0.0.dylib" />
<dllmap os="osx" dll="gtk-quartz-2.0"
target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgtk-quartz-2.0.dylib" />
<dllmap os="osx" dll="gtksharpglue-2" target="/Library/Frameworks/Mono.framework/Versions/Current/lib/libgtksharpglue-2.so" />
Comment 8 Alexis Christoforides 2016-06-08 14:35:27 UTC
This was fixed a while ago (4.0 or 4.2).