views:

83

answers:

1

I thought the purpose of mkbundle2 was to allow a machine without mono installed to run a mono application. But it does not seem to be packaging libmono.so. I am not sure if it is supposed to or not, but the destination machine is complaining that it can't find libmono.so.0 when I run the bundle. Why would it be looking for that file? And if it is needed, why would it be looking anywhere but in the bundle? And if it is supposed to be in the bundle, why didn't mkbundle2 put it there? I am using the "--deps" option for including all dependencies. Am I missing something?

After adding the --static option, I get this result on the destination machine:

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> System.DllNotFoundException: libc at (wrapper managed-to-native) System.Windows.Forms.XplatUI:uname (intptr) at System.Windows.Forms.XplatUI..cctor () [0x00000] in :0

Using export MONO_LOG_LEVEL=debug shows more info:

Mono-INFO: DllImport attempting to load: 'libc'. Mono-INFO: DllImport loading location: 'libc.so'. Mono-INFO: DllImport error loading library: '/usr/lib64/libc.so: invalid ELF header'. Mono-INFO: DllImport loading library: './libc.so'. Mono-INFO: DllImport error loading library './libc.so: cannot open shared object file: No such file or directory'. Mono-INFO: DllImport loading: 'libc'. Mono-INFO: DllImport error loading library 'libc: cannot open shared object file: No such file or directory'.

Does this mean that I'm trying to run on machine with incompatible hardware? Both machines are SUSE Linux Enterprise Server 11 (x86_64).

+1  A: 

From here we have that:

--deps: this option will bundle all of the referenced assemblies for the assemblies listed on the command line option. This is useful to distribute a self-contained image.

Are you sure you're not forgetting to reference an assembly on the command line?

From this thread:

Mono Community › General › Mono Community › mkbundle, static, lgmodule

It appears that mkbundle is not responsible for packaging this assembly. The user solved the problem by installing missing glib-related packages.

Take a look at the static parameter here:

--static: by default mkbundle dynamically links to mono and glib. This option causes it to statically link instead.

Leniel Macaferi
+1 for Leniel. The documentation clearly states: To automatically include all of the dependencies referenced, use the "--deps" command line option.
karlphillip
It was the --static option that I was missing. Thanks.
Fantius
Hmm, it seems there is still a problem. I have edited my question.
Fantius
Also, I don't understand the point of dynamically linking to mono as the default behavior. When you do that, the destination machine must have mono installed, right? If so, what is the point in using mkbundle in the first place?
Fantius
@fantius - As I wrote it appears that you need to install glib-related packages on the target machine, not mono, but a specific package.
Leniel Macaferi