This is an update on the topic.
In the first part I have presented my findings about few languages and tools, hopefully I have inspired a talented friend of mine (I'll refer to him as The Amazing Vlad,or simply The Amazing)
The Amazing works with C#/mono and has tested the Mono's mkbundle for real (in order to create a standalone executable); mkbundle isn't working well as expected, so I have removed mono from the winners list.
Here I paste the translated friend's mail:
Hi,
I am looking torward creating a portable version of KeePass for Linux.
I have installed mono 2.1x on CentOS5 and I have tried creating a bundle for KeePass by using --deps --static.
The first option might bundle all the needed managed assemblies, the sedcond one might statically link the native mono library. (lib_mono_something...)
It turns out that mkbundle doesn't link the other needed native libraries, e.g. libgdiplus which is called by WinForms applications.
I have tried using the generated bundle on CentOS6, and I have faced these problems:
1
It is impossibile to have a priori knowledge (using ldd command) about dynamic library dependencies because managed assemblies load them at runtime .e.g. libc.
Ldd has stated libc as a dependency but something inside the bundle looked for libc.so which it doesn't exist. The error arises because the real name is libc.so.6.
But how does Mono know about the real name of libc library? Quite simple, mono has a configuration file with a number of mapping directives for windows dll and dynamic linux libraries.
I have fixed the issue by copying and renaming the config as NameExecutable.exe.config and I have forced mkbundle to add this file to the bundle.
2
The program still has kept failing and ranting about lacking libgdiplus. As mentioned above, no native dynamic library is bundled with mono (by using --static). So, you are forced copying all the needed libraries with your application (plus their own dependencies).
I have copied libgdiplus.so.x and It still failed cause lacking MonoFuckedLongName.dll which doesn't exist in my system!!
I gave up
NOTE: A simple commandline Hello World application still works flawless, with --deps --static ; no tricks or workarounds are needed.
Conclusion
Mkbundle doesn't work well with complex applications and lot of libraries depencies, but it might work well for simple commandline applications. Perhaps WinForms might work by copying libgdiplus with your application but I have not tested a graphical hello world application yet.
The Amazing
Nessun commento:
Posta un commento