I'm attempting to build a C# Mono application as a native binary so it can be run on Linux systems without any dependencies (Such as Mono).
To ensure some backwards compatibility I am using Ubuntu 12.04 to build the native binary. I had to build Mono 3.x from source as Ubuntu 12.04 only has packages for Mono 2. I documented that process here, if you're interested.
I am using mkbundle to bundle the Mono runtime and its dependencies:
mkbundle -c -o WFTOLauncherNative.c -oo bundles.o --static --deps WFTOLauncher.exe Open.NAT.dll
I am using the cc compiler like so:
cc -o WFTOLauncherNative.exe WFTOLauncherNative.c bundles.o -l:libmono-2.0.a -l:libgdiplus.a -lc -lpthread -lrt -lm -ldl -I /usr/local/include/mono-2.0/
This works on the system I built it on (Ubuntu 12.04). However on Ubuntu 14.04 with no Mono installation I get the following error:
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> System.DllNotFoundException: libc
ldd of the application:
scott#ubuntu:/media/strichnet/WFTOLauncher/bin/Release/LinuxNative$ ldd WFTOLauncherNative.exe
linux-vdso.so.1 => (0x00007fffd0ffe000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa6c794a000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa6c7d27000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa6c772c000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa6c7523000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa6c721d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa6c7019000)
My hunch so far is Mono is at fault here - I think it relies on the Mono DllMap configs to map from libc to libc.so.6, but its failing. There is a similar question on SO and the answer here looks promising, but as my goal is to create an independent native assembly its not a solution I can accept.
I have copied the default Mono 3 config file from /etc/mono/config to the binary directory and renamed it to WFTOLauncher.exe.config and WFTOLauncherNative.exe.config (Just in case). This has not helped.
Full Mono debug trace here: https://gist.github.com/strich/e71b23421cdbe941b4f4
The root cause of the problem was that Mono was looking for libc.so where the OS only had libc.so.6. Mono needs a DllMap config file to understand how to translate this.
The solution to the problem was to add the default Mono3 DllMap config file to the same directory as my binary. Sadly it appears that Mono doesn't cache the DllMap globally for the process, so I had to make multiple duplicate copies of the config file under the different names of the various modules that were being called. For example:
Mono.Posix.dll.config
System.Drawing.dll.config
System.Windows.Forms.dll.config
Related
Posting here as a last resort. Welcome all support.
I am attempting to cross compile a standalone mono app for armv5tejl target device that I cannot modify the OS or system folders. The target device response when executing the output (executable app) from mkbundle looks as if the mono command is being run and not the app (see below).
I have searched on google and here and posted to mono mail-list with no response yet. I have tried many iterations of mkbundle and switches.
Among other links I found this Mono return error: mono mscorlib.dll was not found but it doesn't help as I cannot modify the target machine and I am trying to bundle mono runtime with the app so it is self contained.
I read this http://www.mono-project.com/archived/guiderunning_mono_applications/ and one thing I noticed is that the output from mkbundle on this page lists the words embedding whereas I see only 'attempting to load assembly'
I have a simple Hello World project
using System;
namespace et2
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
}
}
}
That I compile with MonoDevelop in Ubuntu 64-bit VM for .Net 4.6.1 to give and et2.exe and et2.mdb file.
I then run mkbundle
sudo mkbundle --static --cross mono-5.8.0-debian-8-armel $2 -o /tmp/app -v --deps --config /etc/mono/config --machine-config /etc/mono/2.0/machine.config
and get the following results
WARNING:
Check that the machine.config file you are bundling
doesn't contain sensitive information specific to this machine.
From: /home/user/.mono/targets/mono-5.8.0-debian-7-armel
OS is: Linux
Sources: 1 Auto-dependencies: True
Attempting to load assembly: et2.exe
Assembly et2.exe loaded successfully.
Attempting to load assembly from: ./I18N.West.dll
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N.West.dll
Attempting to load assembly from: ./I18N.dll
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N.dll
Attempting to load assembly from: ./mscorlib
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/mscorlib
Attempting to load assembly from: ./mscorlib
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/mscorlib
Attempting to load assembly from: ./I18N
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N
Attempting to load assembly from: ./mscorlib
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/mscorlib
Using runtime: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/bin/mono
At 0 with input 3308440
At 328000 with input 4608
Assembly: /home/user/dev/et2/et2.exe
At 32a000 with input 3891712
Assembly: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/mscorlib.dll
At 6e1000 with input 72192
Assembly: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N.West.dll
At 6f3000 with input 38912
Assembly: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N.dll
At 6fd000 with input 2797
systemconfig: /etc/mono/config
At 6fe000 with input 34053
machineconfig: /etc/mono/4.5/machine.config
assembly:et2.exe at (3309568, 4608)
assembly:mscorlib.dll at (3317760, 3891712)
assembly:I18N.West.dll at (7213056, 72192)
assembly:I18N.dll at (7286784, 38912)
systemconfig: at (7327744, 2797)
machineconfig: at (7331840, 34053)
Generated /home/user/dev/tmp/app
running 'file app' gives
app: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.26, BuildID[sha1]=2a2d299a01c95dc50ff7c3db65c390234c0cd8bd, stripped
When I copy the file app to the target device and try to execute I get the following response that looks as if I am executing mono but app should be the bundled app.
root#device:/cust# ./app
Usage is: mono [options] program [program-options]
Development:
--aot[=<options>] Compiles the assembly to native code
--debug[=<options>] Enable debugging support, use --help-debug for details
--debugger-agent=options Enable the debugger agent
--profile[=profiler] Runs in profiling mode with the specified profiler module
--trace[=EXPR] Enable tracing, use --help-trace for details
--jitmap Output a jit method map to /tmp/perf-PID.map
--help-devel Shows more options available to developers
Runtime:
--config FILE Loads FILE as the Mono config
--verbose, -v Increases the verbosity level
--help, -h Show usage information
--version, -V Show version information
--runtime=VERSION Use the VERSION runtime, instead of autodetecting
--optimize=OPT Turns on or off a specific optimization
Use --list-opt to get a list of optimizations
--security[=mode] Turns on the unsupported security manager (off by default)
mode is one of cas, core-clr, verifiable or validil
--attach=OPTIONS Pass OPTIONS to the attach agent in the runtime.
Currently the only supported option is 'disable'.
--llvm, --nollvm Controls whenever the runtime uses LLVM to compile code.
--gc=[sgen,boehm] Select SGen or Boehm GC (runs mono or mono-sgen)
--handlers Install custom handlers, use --help-handlers for details.
--aot-path=PATH List of additional directories to search for AOT images.
root#device:/cust#
If I try './app app' on the target device I get
root#device:/cust# ./app app
The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the `/usr/lib/mono/4.5/mscorlib.dll' directory.
root#device:/cust#
running 'ldd app' on the target device gives
root#device:/cust# ldd app
libm.so.6 => /lib/libm.so.6 (0x4014a000)
librt.so.1 => /lib/librt.so.1 (0x4008f000)
libdl.so.2 => /lib/libdl.so.2 (0x4011c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x400ba000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4002f000)
libc.so.6 => /lib/libc.so.6 (0x401fb000)
/lib/ld-linux.so.3 (0x4005e000)
root#device:/cust#
running 'uname -a' on the target device gives
root#device:/cust# uname -a
Linux device 2.6.39.4 #2 PREEMPT Tue Jan 24 16:46:54 UTC 2017 armv5tejl GNU/Linux
Some notes
I have searched and searched
I have read about mkbundle and "man mkbundle" and read many documents on mono website
I only have access to modify one folder on the target device
Installing mono or updating the target device is not an option.
I am not sure why ./app app is looking for mscorlib.dll when it looks to be embedded in the app by mkbundle, (possible wrong
version?)
Mono version used
user#ubuntu:~/dev/tmp$ mono --version
Mono JIT compiler version 5.8.0.108 (tarball Fri Jan 19 18:15:21 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen (concurrent by default)
VM used for development info
user#ubuntu:~/dev/tmp$ uname -a
Linux ubuntu 4.13.0-32-generic #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Thanks to anyone who reads this and has suggestions or can help.
twgcim1
EDIT, update
If I copy the mscorlib.dll from /usr/lib/mono/4.5/mscorlib.dll to the same folder as the app in the target device and set MONO_PATH=.
Then when trying to execute ./app app I get the following response
Cannot open assembly 'app': File does not contain a valid CIL image.
I am trying to bundle the application with mono 3.2.3 to a stand-alone executable. To do so, I am following this guideline. After declarating variables:
mono_version="3.2.3"
export MONO=/cygdrive/c/progra~2/Mono-$mono_version
machineconfig=$PROGRAMFILES\\Mono-$mono_version\\etc\\mono\\4.5\\machine.config
export PATH=$PATH:$MONO/bin
export PKG_CONFIG_PATH=$MONO/lib/pkgconfig
export CC="i686-pc-mingw32-gcc -U _WIN32"
mkbundle --deps command cannot localize referenced assemblies:
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'gtk-sharp' or
one of its dependencies. The system cannot find the file specified.
File name: 'gtk-sharp'
performing exactly the same operation with mono 2.10.9:
mono_version="2.10.9"
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
export CC="i686-pc-mingw32-gcc -U _WIN32"
mkbundle --deps --machine-config "$machineconfig" -c UI.exe
gives positive result:
OS is: Windows
WARNING:
Check that the machine.config file you are bundling
doesn't contain sensitive information specific to this machine.
Sources: 3 Auto-dependencies: True
embedding: C:\users\piotr\desktop\authoringtool\UI\bin\debug\UI.exe
config from: C:\users\piotr\desktop\authoringtool\UI\bin\debug\UI.exe.config
embedding: C:\PROGRA~2\MONO-2~1.9\lib\mono\gac\gtk-sharp\2.12.0.0__35e10195dab3c99f\gtk-sharp.dll
embedding: C:\PROGRA~2\MONO-2~1.9\lib\mono\gac\glib-sharp\2.12.0.0__35e10195dab3c99f\glib-sharp.dll
.
.
.
embedding: C:\PROGRA~2\MONO-2~1.9\lib\mono\4.0\Mono.Posix.dll
Machine config from: C:\Program Files (x86)\Mono-2.10.9\etc\mono\4.0\machine.config
Compiling:
as -o temp.o temp.s
Does anyone know the reason of such behavior? I'm using 64-bit version of windows 7 and the Cygwin I found on the official website. The code was compiled and tested on Xamarin Studio 4.2 and Visual Studio 2010.
Howto for mkbundle on cygwin + mingw
Tested with mono 4.0.3
In mono 4.0.3, mkbundle works but it can be tricky to make it work.
First, check your setup:
Install Mono/GTK# in a path that doesn't contains spaces (ie not Program Files then)
Setup a MinGw/Cygwin working compile chain (as the one for
compiling mono on windows).
Define the mandatory environment variables for mkbundle:
mingw compiler location should be in the Windows PATH (used by cmd)
pkg-config should also be in the Windows PATH
Use the following cygwin script (it can be adapted to run on cmd)
# M_PREFIX refers to Mono installation
# For more information, search for prefix installation in Mono documentation
M_PREFIX='/cygdrive/c/Mono'
export DYLD_FALLBACK_LIBRARY_PATH=${M_PREFIX}/lib:${DYLD_FALLBACK_LIBRARY_PATH}
export LD_LIBRARY_PATH=${M_PREFIX}/lib:${M_PREFIX}/lib/mono/4.5:${LD_LIBRARY_PATH}
export C_INCLUDE_PATH=${M_PREFIX}/include:${C_INCLUDE_PATH}
export ACLOCAL_PATH=${M_PREFIX}/share/aclocal:${ACLOCAL_PATH}
export PKG_CONFIG_PATH=${M_PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}
# Here we added the system32 to make cmd available to mkbundle
# /usr/bin is the default location for mingw
export PATH=${M_PREFIX}/bin:/cygdrive/c/Windows/system32:/usr/bin:${PATH}
export CC="i686-pc-mingw32-gcc -U _WIN32"
Then you can run:
mkbundle --deps --keeptemp my.exe my.dll -o bundled.exe
Notes:
- Copy mono-2.0.dll in the application directory as it should be distributed along the bundled exe
cp ${M_PREFIX}/bin/mono-2.0.dll .
if -z is used, zlib1.dll should be copied as well. (note that gcc invocation change also). You may need more dll depending on your usage of framework features (not exhaustive list : libglib*.dll, libgmodule*.dll, libgthread*.dll, iconv.dll, intl.dll)
-c is used to generate only stub.
You must specify all exe and dll that are needed for the bundle.
--keeptemp will keep temp.c and temp.s which could come in handy if mkbundle fail on gcc invocation.
If you want to invoke gcc by hand (and it may be needed):
i686-pc-mingw32-gcc -U _WIN32 -g -o output.exe -Wall temp.c $(pkg-config --cflags --libs mono-2) temp.o
For Console Applications
To make console application work you must remove -mwindows from the gcc command. To do that, you must invoke pkg-config --cflags --libs mono-2 and remove the -mwindows.
You should obtain something like that afterwards:
i686-pc-mingw32-gcc -g -o output.exe -Wall temp.c -mms-bitfields -IC:/Mono/include/mono-2.0 -mms-bitfields -LC:/Mono/lib -lmono-2.0 -lws2_32 -lpsapi -lole32 -lwinmm -loleaut32 -l advapi32 -lversion temp.s
Anyone can improve mkbundle
mkbundle is an open sourced C# console application (on mono github)
so it can be easily modified and recompiled depending on your needs.
Reading the code could also be helpful to understand how it works underneath.
cmd usage as the different commands used by mkbundle are hard coded so it would benefit from some parametrization enhancement.
Im trying to create an executable from a console application.
I have installed mono,cygwin (mingw-gcc, mingw-zlib1, mingw-zlib-devel, pkg-config) and I have added the following lines to my .bashrc file
export PKG_CONFIG_PATH=/cygdrive/c/progra~1/Mono-3.2.3/lib/pkgconfig
export PATH=$PATH:/cygdrive/c/progra~1/Mono-3.2.3/bin
export CC="i686-pc-mingw32-gcc -U _WIN32"
But everytime I try to use mkbundle I receive the following message
Is there a way to make mkbundle work properly on windows.?
(Im using windows 7 x86, mono 3.2.3, the cygwin I found on the official website, xamarin studio 4.2 and net framwork 4)
This problem is still presented in the current mono version under the Windows. This happened because of mono team switched default GC to SGEN. So when you try to use mkbundle as you can see in your error mkbundle utility try to find mono-2 library but this lib didn't included in setup and you have a fail. To solve this you should configure mkbundle to use libmonosgen-2.0 instead of mono-2. Let's try to do this.
The key moment is setting this variable:
export PKG_CONFIG_PATH=/cygdrive/c/progra~1/Mono-3.2.3/lib/pkgconfig
If you go to this directory you will see a lot of *.pc files (package config). This files are responsible for configuration of linking libraries during bundling process. For some reasons mono team hard coded package config file and library to mono-2 (see this line 492). How could we fix it without rebuilding mkbundle? The solution is to use the next bundle script:
# Mono paths
mono_version="3.2.3"
export MONO=/cygdrive/c/progra~2/Mono-$mono_version
machineconfig=$PROGRAMFILES\\Mono-$mono_version\\etc\\mono\\4.5\\machine.config
export PATH=$PATH:$MONO/bin
export PKG_CONFIG_PATH=$MONO/lib/pkgconfig
# Compiller
export CC="i686-pc-mingw32-gcc -U _WIN32"
# Output file name
output_name=Prog.exe
# Produce stub only, do not compile
mkbundle --deps --machine-config "$machineconfig" -c Program.exe
# Produce helper object file. You may see errors at this step but it's a side effect of this method.
mkbundle --deps --machine-config "$machineconfig" -oo temp.o Program.exe
# Compile. Pay attention where I use monosgen-2
i686-pc-mingw32-gcc -U _WIN32 -g -o "$output_name" -Wall temp.c `pkg-config --cflags --libs monosgen-2` temp.o
# Copy libmonosgen-2.dll
cp $MONO/bin/libmonosgen-2.0.dll .
# Run
./$output_name
I had the same problem some time ago and made a script for cygwin. You can try it, would be interesting whether it still works:
mkbunde cygwin script
There are explanations in the script how to setup the environment.
Howto for mkbundle on cygwin + mingw
Here you can find an updated howto make mkbundle work on Windows
First, check your setup:
Install Mono/GTK# in a path that doesn't contains spaces (ie not Program Files then)
Setup a MinGw/Cygwin working compile chain (as the one for
compiling mono on windows).
Define the mandatory environment variables for mkbundle:
mingw compiler location should be in the Windows PATH (used by cmd)
pkg-config should also be in the Windows PATH
Use a cygwin script to defined mono and mingw required variables.
Then you can run:
mkbundle --deps --keeptemp my.exe my.dll -o bundled.exe
Notes:
Copy mono-2.0.dll in the application directory as it should be distributed along the bundled exe
You must specify all exe and dll that are needed for the bundle.
--keeptemp will keep temp.c and temp.s which could come in handy if mkbundle fail on gcc invocation.
If you want to invoke gcc by hand (and it may be needed):
i686-pc-mingw32-gcc -U _WIN32 -g -o output.exe -Wall temp.c $(pkg-config --cflags --libs mono-2) temp.o
Anyone can improve mkbundle
mkbundle is an open sourced C# console application (on mono github)
so it can be easily modified and recompiled depending on your needs.
Reading the code could also be helpful to understand how it works underneath.
I am using Mono on Mac, installed with Unity.
The http://www.mono-project.com/Mono:Runtime:Documentation:AOT page states that mono compiler with aot option should generate .so file.
What I get is a dylib file.
My goal is to generate so file from the managed c# dll file.
Here is the command and output (in terminal):
Gerleis-Mac:CrazInvaders gerleim$ /Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/2.10.2/bin/mono --aot -O=all iOSBuild/Data/Managed/Assembly-CSharp.dll
Mono Ahead of Time compiler - compiling assembly /Users/gerleim/Desktop/CrazInvaders/iOSBuild/Data/Managed/Assembly-CSharp.dll
Code: 2217337 Info: 87704 Ex Info: 56841 Unwind Info: 80 Class Info: 4663 PLT: 5477 GOT Info: 364454 GOT: 35852 Offsets: 109275
Executing the native assembler: as -arch i386 -W -o /var/folders/b4/4tgynrr570zd5qdng_4ljs9m0000gn/T/mono_aot_uGBs4E.o /var/folders/b4/4tgynrr570zd5qdng_4ljs9m0000gn/T/mono_aot_uGBs4E
Executing the native linker: gcc -m32 -dynamiclib -o /Users/gerleim/Desktop/CrazInvaders/iOSBuild/Data/Managed/Assembly-CSharp.dll.dylib.tmp /var/folders/b4/4tgynrr570zd5qdng_4ljs9m0000gn/T/mono_aot_uGBs4E.o
Compiled 12759 out of 12761 methods (99%)
2 methods have other problems (0%)
Methods without GOT slots: 8190 (64%)
Direct calls: 716 (20%)
JIT time: 1427 ms, Generation time: 1045 ms, Assembly+Link time: 1712 ms.
I guess there are problems with the parameters of the assembler and linker, but I don't have options to change those (see http://mono.wikia.com/wiki/Man_mono)
(When built from the Unity IDE, Unity uses mono and aot and generates .s files for XCode/iOS.)
.sos are Linux binaries, so you'd have to compile ahead-of-time on a Linux. When you do this on OS X instead, you get a .dylib because that's an OS X library binary. Even if you had a Linux binary on your Mac, it'd be useless to you.
I have a very simple .NET commandline application that I want to port to OS X.
I can run it with "mono app.exe"
However, the destination machines won't have mono installed.
So, I wanted to bundle mono inside the app.
In order to do this, I used mkbundle2:
mkbundle2 -o bundledapp.exe app.exe --deps
This works without errors, output:
OS is: Darwin
Sources: 1 Auto-dependencies: True
embedding: /Users/kclement/Projects/app/build/app.exe
embedding: /Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/2.0/mscorlib.dll
embedding: /Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll
embedding: /Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
embedding: /Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
embedding: /Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/System.Security/2.0.0.0__b03f5f7f11d50a3a/System.Security.dll
embedding: /Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/Mono.Security/2.0.0.0__0738eb9f132ed756/Mono.Security.dll
Compiling:
as -arch i386 -o temp.o temp.s
cc -g -o bundledapp.exe -Wall temp.c `pkg-config --cflags --libs mono` temp.o
Done
I can execute this on the build machine. When I execute on a machine without mono however, it won't run.
Output:
dyld: Library not loaded: /Library/Frameworks/Mono.framework/Versions/2.6.1/lib/libmono.0.dylib
Referenced from: /Users/kristof/./bundledapp.exe
Reason: image not found
Trace/BPT trap
What am I missing? How do I include the actual mono runtime?
EDIT:
I also tried adding the --static flag.
That gives my app another license however, which I'm not sure I want.
I then no longer complains about libmono, but about libgthread-2.0.0.dylib
So, the problem is that mkbundle links to some file that reside on my mac, where I expected it to bundle them. You can clearly see that by looking up the linked resources with the command:
otool -L ./BundledApp
(where bundledApp is the output of mkbundle2)
In order to fix it, I ended up using the mkbundle nant-tasks from the monobjc project:
http://www.monobjc.net/index.php?page=mkbundle-task
I think they are pretty much an automated version of what I found here:
http://code.google.com/p/cocoa-sharp-dev/wiki/RedistributableAppWithoutInstallingMono
But that gave me exceptions.
The Monobjc nant task works without any issues, and is by far the easiest solution. I still have multiple files but that's ok, at least it works now.
Try running:
mkbundle -o bundledappname program.exe
--deps
(use a different name for the bundle rather than the same as your program.exe and do not put .exe extension to the -o flag)
Also, did you tried macpack ?
For more information on how to create bundles read here and the fine manual of mkbundle