After packaging with mkbundle2, the destination machine is complaining about libmono.so. Why?

StackOverflow https://stackoverflow.com/questions/3250752

  •  15-09-2020
  •  | 
  •  

Question

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).

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top