Bug 31962 - System.DllNotFoundException: libglib-2.0-0.dll on run without debug
Summary: System.DllNotFoundException: libglib-2.0-0.dll on run without debug
Status: NEW
Alias: None
Product: Gtk#
Classification: Mono
Component: gtk-sharp ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-15 02:40 UTC by wzalaznik
Modified: 2017-11-30 18:26 UTC (History)
4 users (show)

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


Attachments
ide.log (85.12 KB, text/x-log)
2015-07-15 02:40 UTC, wzalaznik
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 for Bug 31962 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description wzalaznik 2015-07-15 02:40:23 UTC
Created attachment 12031 [details]
ide.log

I put a libglib-2.0-0.dll copy in /usr/lib/monodevelop/bin. Didn't work.
Tried adding it in references dialog said this copy was not a valid .NET assembly.
Attaching ide.log.

Unhandled Exception:
System.DllNotFoundException: libglib-2.0-0.dll
  at (wrapper managed-to-native) GLib.Marshaller:g_malloc (uintptr)
  at GLib.Marshaller.StringToPtrGStrdup (System.String str) [0x00000] in <filename unknown>:0 
  at GLib.Global.set_ProgramName (System.String value) [0x00000] in <filename unknown>:0 
  at Gtk.Application.SetPrgname () [0x00000] in <filename unknown>:0 
  at Gtk.Application.Init () [0x00000] in <filename unknown>:0 
  at csvtosql.MainClass.Main (System.String[] args) [0x00007] in /home/will/Projects/csvtosql/csvtosql/Program.cs:11 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libglib-2.0-0.dll
  at (wrapper managed-to-native) GLib.Marshaller:g_malloc (uintptr)
  at GLib.Marshaller.StringToPtrGStrdup (System.String str) [0x00000] in <filename unknown>:0 
  at GLib.Global.set_ProgramName (System.String value) [0x00000] in <filename unknown>:0 
  at Gtk.Application.SetPrgname () [0x00000] in <filename unknown>:0 
  at Gtk.Application.Init () [0x00000] in <filename unknown>:0 
  at csvtosql.MainClass.Main (System.String[] args) [0x00007] in /home/will/Projects/csvtosql/csvtosql/Program.cs:11 

=== MonoDevelop ===

Version 5.9.4
Installation UUID: b0da8866-fd0b-4ddd-802d-8f33fc6b4b35
Runtime:
	Mono 4.0.2 (Stable 4.0.2.5/c99aa0c Wed Jun 24 10:04:37 UTC 2015) (64-bit)
	GTK+ 2.24.23 (oxygen-gtk theme)

=== Build Information ===

Build information unavailable

=== Operating System ===

Linux
Linux lakota 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 cool_rainbow 2015-12-11 10:27:50 UTC
Hi,

Did you solve this problem?
Comment 2 Opzet 2017-06-28 07:06:25 UTC
This is an old thread 2015, I am having the same problem

You can Debug and get extra info on where it is failing using this.

> MONO_LOG_LEVEL=debug mono <ProgranName>.exe

If a library location has not been explicitly specified in a DllMap entry in an application or assembly .config file, Mono will search for a library in a few places.

To preserve compatibility with the .NET Framework, mono uses the same library names as windows. These names are mapped to linux library names using DllMaps.
http://www.mono-project.com/docs/advanced/pinvoke/dllmap/ 

See if lib exists
> find /usr -name libglib-2.0.so

See if it can be found
>sudo ldconfig -p |grep libglib-2.0

In my instance there is no DllMap for libglib

so I have to create one...somewhere... argh

<configuration>

<dllmap os="linux" dll="libglib-2.0-0.dll" target="libglib-2.0.so.0"/>

</configuration>
Comment 3 Opzet 2017-06-28 08:42:13 UTC
You add DllMaps on the device

edit 

> /etc/mono/config

add

	<dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so" os="!windows"/>
	<dllmap dll="libglib-2.0-0.dll" target="libglib-2.0.so.0" os="linux"/>
Comment 4 Opzet 2017-06-28 09:27:09 UTC
This is interesting...

https://github.com/AppImage/AppImageKit/wiki/Bundling-Mono-apps
Comment 5 Opzet 2017-06-28 09:47:36 UTC
https://download.mono-project.com/runtimes/raw/


> mono-5.0.1-raspbian-8-arm.zip

This has the config files etc
Comment 6 Jesus Eguiluz 2017-11-30 18:26:28 UTC
I have the same problem but in windows 10 with .NET 4.6.2 and GTK sharp 2.12.45

Excepción no controlada: System.DllNotFoundException: No se puede cargar el archivo DLL 'libglib-2.0-0.dll': No se puede encontrar el módulo especificado. (Excepción de HRESULT: 0x8007007E)
   en GLib.Marshaller.g_utf16_to_utf8(Char* native_str, IntPtr len, IntPtr items_read, IntPtr items_written, IntPtr& error)
   en GLib.Marshaller.StringToPtrGStrdup(String str)
   en GLib.Global.set_ProgramName(String value)
   en Gtk.Application.SetPrgname()
   en Gtk.Application.Init()

I do the black magic in 
https://forums.xamarin.com/discussion/15568/unable-to-load-dll-libgtk-win32-2-0-0-dll

But does not work.

I downgrade to GTK Sharp 2.12.26 and work perfect, the 2.12.26 is the only version thas work in every windows that I test.

So, is the Gtk.Application.SetPrgname() method tested sufficient?