c# - Mono mkbundle throws weird error -
i've been trying compile or bundle application using mkbundle. script i'm executing:
set -o errexit set -o nounset mono_version="3.2.3" export mono=/cygdrive/c/progra~2/mono-$mono_version machineconfig=$programfiles\\mono-$mono_version\\etc\\mono\\4.0\\machine.config export path=$path:$mono/bin export pkg_config_path=$mono/lib/pkgconfig icon_name='"icon.ico"' echo "1 icon $icon_name" > icon.rc export cc="i686-pc-mingw32-gcc icon.o -u _win32" output_name=output.exe mkbundle jiratempoapp.exe monoposixhelper.dll gtk-sharp.dll glib-sharp.dll atk-sharp.dll gdk-sharp.dll glade-sharp.dll glib-sharp.dll pango-sharp.dll restsharp.dll jirarestlib.dll --deps --machine-config "$machineconfig" -o $output_name -z rm icon.rc rm icon.o cp $mono/bin/mono-2.0.dll . cp $mono/bin/zlib1.dll . ./$output_name
i had add monoposixhelper.dll because got entrypoint not found error. got weird error:
$ ./mkbundle_cygwin.sh os is: windows warning: check machine.config file bundling doesn't contain sensitive information specific machine. sources: 11 auto-dependencies: true unhandled exception: ikvm.reflection.badimageformatexception: exception of type 'ikvm.reflection.badimageformatexception' thrown. @ ikvm.reflection.reader.pereader.rvatofileoffset (uint32 rva) [0x00000] in <filename unknown>:0 @ ikvm.reflection.reader.modulereader.read (system.io.stream stream) [0x00000] in <filename unknown>:0 @ ikvm.reflection.reader.modulereader..ctor (ikvm.reflection.reader.assemblyreader assembly, ikvm.reflection.universe universe, system.io.stream stream, system.string location) [0x00000] in <filename unknown>:0 @ ikvm.reflection.universe.openrawmodule (system.io.stream stream, system.string location) [0x00000] in <filename unknown>:0 @ ikvm.reflection.universe.openrawmodule (system.string path) [0x00000] in <filename unknown>:0 @ ikvm.reflection.universe.loadfile (system.string path) [0x00000] in <filename unknown>:0 @ makebundle.loadassembly (system.string assembly) [0x00000] in <filename unknown>:0 @ makebundle.loadassemblies (system.collections.generic.list`1 sources) [0x00000] in <filename unknown>:0 @ makebundle.main (system.string[] args) [0x00000] in <filename unknown>:0 [error] fatal unhandled exception: ikvm.reflection.badimageformatexception: exception of type 'ikvm.reflection.badimageformatexception' thrown. @ ikvm.reflection.reader.pereader.rvatofileoffset (uint32 rva) [0x00000] in <filename unknown>:0 @ ikvm.reflection.reader.modulereader.read (system.io.stream stream) [0x00000] in <filename unknown>:0 @ ikvm.reflection.reader.modulereader..ctor (ikvm.reflection.reader.assemblyreader assembly, ikvm.reflection.universe universe, system.io.stream stream, system.string location) [0x00000] in <filename unknown>:0 @ ikvm.reflection.universe.openrawmodule (system.io.stream stream, system.string location) [0x00000] in <filename unknown>:0 @ ikvm.reflection.universe.openrawmodule (system.string path) [0x00000] in <filename unknown>:0 @ ikvm.reflection.universe.loadfile (system.string path) [0x00000] in <filename unknown>:0 @ makebundle.loadassembly (system.string assembly) [0x00000] in <filename unknown>:0 @ makebundle.loadassemblies (system.collections.generic.list`1 sources) [0x00000] in <filename unknown>:0 @ makebundle.main (system.string[] args) [0x00000] in <filename unknown>:0
my .exe succesfully running on windows , ubuntu i'm trying bundle users don't have download mono.
mkbundle
can't handle dynamically linked libraries monoposixhelper.dll
. if want application run without mono, need deploy (and other libraries) application on target system.
if want run application on ubuntu , don't want user install libgtk2.0-cil, have deploy libatksharpglue-2.so libgdksharpglue-2.so libglibsharpglue-2.so libgtksharpglue-2.so libpangosharpglue-2.so
*-sharp.dll
s require them.
then make sure target system able find these libraries. either defining ld_library_path
or creating dll-maps on build system (which tricky , can little tedious).
you can pass --static
parameter mkbundle
include needed mono libraries directly in bundle (see manpage details). also, execute final bundle myapp.exe
not mono myapp.exe
.
here options linux targets. didn't use mkbundle
mono on windows, yet, compiled against .net msbuild
, creates .msi
files.
option 1:
$deps = "gtk-sharp.dll glib-sharp.dll atk-sharp.dll gdk-sharp.dll glade-sharp.dll glib-sharp.dll pango-sharp.dll restsharp.dll jirarestlib.dll" mkbundle --static -o jiratempoapp jiratempoapp.exe --deps $deps --machine-config "$machineconfig" -z
then make sure deploy monoposixhelper.dll
. , other .so
files depicted above system. start application, execute
ld_library_path=/path/to/deployed/libs:$ld_library_path jiratempoapp
however, cannot verify method setting ld_library_path
works @ moment.
option 2:
build same command in option 1, execute directory of deployed libs:
cd /path/to/deployed/libs; /path/to/jiratempoapp
option 3:
this little more complicated: need find dependency .dll
s , .dll.config
files on build system. copy them build directory , dll mapping in config file mapping includes relative path location of .so
files on target system. way, dll mapping gets packed mkbundle , packed executable able find deployed .so
s on target system. once wrote makefile application uses option, maybe you.
Comments
Post a Comment