[Mono-osx] Bundled mono console application on OS X throwing gthread errors.

silver83 silver83 at gmail.com
Tue Nov 11 06:48:07 EST 2008

I have bundled a mono console application using the following steps :
1. use mkbundle to create the binary
2. use macpack to create a dummy .app
3. inject the bundled binary into the .app's resources folder
4. rewire the execution script and the files under /Resources to execute the

I run the application and everything is fine, but now I want to rewire
library dependencies - 
I'm using code from : 

to inject mono libraries into Resources folder, rewire my app to use them,
and rewire them to use themselves (using otool -L to see their dependencies,
and install_name_tool to rewire them).

During rewiring, I exclude things that I consider "non-mono" -
CoreFoundation, Carbon, libgcc, and libSystem.  I've tried several mixtures
of which libraries to exclude, and I either end up with a mono-dependent
application, or an application that crashed on :

GThread-ERROR **: GThread system may only be initialized once.

Some of the crash report : 
Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib                   0x95123b9e __kill + 10
1   libSystem.B.dylib                   0x9519aec2 raise + 26
2   libSystem.B.dylib                   0x951aa47f abort + 73
3   libglib-2.0.0.dylib                 0x00c00ecc g_log + 0
4   libglib-2.0.0.dylib                 0x00c00ef5 g_log + 41
5   libgthread-       0x009ec3d7 g_thread_init + 521
6   libmono.0.0.0.dylib                 0x002c933d mini_init + 2968
7   libmono.0.0.0.dylib                 0x0030fa63 mono_main + 454
8   MyApp                         0x00001f62 main + 215
9   MyApp                         0x00001df2 start + 54

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000000  ebx: 0x951aa43f  ecx: 0xbffff47c  edx: 0x95123b9e
  edi: 0x00000002  esi: 0x00d08010  ebp: 0xbffff498  esp: 0xbffff47c

Any help (clues, hints, things I can do to debug this, maybe dtrace or
something) - would be much appreciated...

Thanks in advance 

View this message in context: http://www.nabble.com/Bundled-mono-console-application-on-OS-X-throwing-gthread-errors.-tp20437966p20437966.html
Sent from the Mono - OSX mailing list archive at Nabble.com.

More information about the Mono-osx mailing list