Yes, mkbundle creates its own executables. For example, on Linux, here is my .NET assembly:
file Agent.exe Agent.exe: PE32 executable (console) Intel 80386, Mono/.Net assembly, for MS Windows
I mkbundle compile it for my own executable file (here I need to add Common.dll, which is a dependency of my Agent.exe assembly):
mkbundle --deps -o Agent Agent.exe Common.dll
OS is: Linux
Sources: 3 Auto-dependencies: True
embedding: Agent / bin / Debug / Agent.exe
embedding: Agent / bin / Debug / Common.dll
embedding: /usr/lib/mono/4.5/mscorlib.dll
embedding: /usr/lib/mono/gac/System.Runtime.Serialization/4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
embedding: /usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
embedding: /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
embedding: /usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
embedding: /usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
embedding: /usr/lib/mono/gac/System.Security/4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
embedding: /usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
embedding: /usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll
embedding: /usr/lib/mono/gac/System.Data.Linq/4.0.0.0__b77a5c561934e089/System.Data.Linq.dll
embedding: /usr/lib/mono/gac/System.Data/4.0.0.0__b77a5c561934e089/System.Data.dll
embedding: /usr/lib/mono/gac/Mono.Data.Tds/4.0.0.0__0738eb9f132ed756/Mono.Data.Tds.dll
embedding: /usr/lib/mono/gac/System.Transactions/4.0.0.0__b77a5c561934e089/System.Transactions.dll
embedding: /usr/lib/mono/gac/System.EnterpriseServices/4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
Compiling:
as -o temp.o temp.s
cc -ggdb -o Agent -Wall temp.c `pkg-config --cflags --libs mono-2` temp.o
Done
Now, run the file command again, this time against the generated binary agent:
file Agent Agent: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=698384c13208eccc609e5a573deeb09ed3420a29, not stripped
Note: this native binary is still dependent on libmono (the Mono runtime library), so it will not work on a machine without a working Mono installation.
However, you can embed libmono in your binary and get an independent standalone executable using the mkbundle --static .
source share