[Mono-dev] Mono on Embedded Platform
Jonathan Pryor
jonpryor at vt.edu
Mon Nov 24 15:57:44 UTC 2014
On Nov 23, 2014, at 11:45 PM, techi eth <techieth at gmail.com> wrote:
> I would be happy if I will get all running under 10 MB.I have listed approx size of few essential. I am not sure how to reduce & get size under 10 MB.
Where are you getting these file sizes? Perhaps you need to strip(1) the binaries?
> 1) Mono (link to mono->sgen) : 13 MB
I'm not sure what this means. If you mean the mono binary, you need to strip(1) it; on OS X, it's 4.1MB.
> 2) Libmono-2.0.so : 12 MB
You need to strip(1) this binary. On OS X, libmonosgen-2.0.1.dylib is 4.2MB.
Also note that the `mono` binary doesn't require libmono*.so; it statically links it in. libmono*.so is for embedding use.
> 3) Mscorelib.dll : 15 MB
Where are you getting this file size? On OS X, the 4.5 mscorlib.dll is 2.9MB.
For example, consider mkbundle(1):
http://docs.go-mono.com/?link=man%3amkbundle(1)
mkbundle(1) can be used to bundle all assemblies into a single file, to simplify distribution. Using mkbundle(1), you can have a single native binary which only requires libmonoboehm-2.dylib to execute, no additional assemblies, by using `mkbundle --deps`:
$ AS='as -arch i386' \
CC='cc -arch i386' \
PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Libraries/pkgconfig \
mkbundle --deps -z hw.exe -o hw2
$ ls -lh hw2
-rwxr-xr-x+ 1 jon staff 1.0M Nov 24 10:53 hw2
$ nm -ufm hw2
(undefined) external ___memcpy_chk (from libSystem)
(undefined) external ___stderrp (from libSystem)
(undefined) external _exit (from libSystem)
(undefined) external _fprintf (from libSystem)
(undefined) external _getenv (from libSystem)
(undefined) external _inflate (from libz)
(undefined) external _inflateEnd (from libz)
(undefined) external _inflateInit2_ (from libz)
(undefined) external _malloc (from libSystem)
(undefined) external _memset (from libSystem)
(undefined) external _mono_main (from libmonoboehm-2)
(undefined) external _mono_register_bundled_assemblies (from libmonoboehm-2)
(undefined) external _mono_set_dirs (from libmonoboehm-2)
(undefined) external _printf (from libSystem)
(undefined) external _strchr (from libSystem)
(undefined) external _strdup (from libSystem)
(undefined) external dyld_stub_binder (from libSystem)
With the above setup, "Hello world" requires "only" ~5.2MB of disk to run (for OS X binaries).
- Jon
More information about the Mono-devel-list
mailing list