1Mono is a software platform designed to allow developers to easily
2create cross platform applications. It is an open source
3implementation of Microsoft's .NET Framework based on the ECMA
4standards for C# and the Common Language Runtime.
81. [Compilation and Installation](#compilation-and-installation)
92. [Using Mono](#using-mono)
103. [Directory Roadmap](#directory-roadmap)
114. [Contributing to Mono](#contributing-to-mono)
125. [Reporting bugs](#reporting-bugs)
136. [Configuration Options](#configuration-options)
147. [Working with Submodules](#working-with-submodules)
18Officially supported architectures:
20| debian-amd64 | debian-i386 | debian-armel | debian-armhf | windows-amd64 |
22| [![debian-amd64]] | [![debian-i386]] | [![debian-armel]] | [![debian-armhf]] | [![windows-amd64]] |
24Community supported architectures:
26| centos-s390x |
28| [![centos-s390x]] |
43Compilation and Installation
46Building the Software
49Please see our guides for building Mono on
50[Mac OS X](http://www.mono-project.com/docs/compiling-mono/mac/),
54Note that building from Git assumes that you already have Mono installed,
55so please download and [install the latest Mono release](http://www.mono-project.com/download/)
56before trying to build from Git. This is required because the Mono build
57relies on a working Mono C# compiler to compile itself
58(also known as [bootstrapping](http://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
60If you don't have a working Mono installation
63If you don't have a working Mono installation, you can try a slightly
64more risky approach: getting the latest version of the 'monolite' distribution,
65which contains just enough to run the 'mcs' compiler. You do this with:
67 # Run the following line after ./autogen.sh
68 make get-monolite-latest
70This will download and place the files appropriately so that you can then
75The build will then use the files downloaded by `make get-monolite-latest`.
77Testing and Installation
80You can run the mono and mcs test suites with the command: `make check`.
82Expect to find a few test suite failures. As a sanity check, you
83can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
85You can now install mono with: `make install`
87You can verify your installation by using the mono-test-install
88script, it can diagnose some common problems with Mono's install.
89Failure to follow these steps may result in a broken installation.
94Once you have installed the software, you can run a few programs:
96* `mono program.exe` runtime engine
98* `mcs program.cs` C# compiler
100* `monodis program.exe` CIL Disassembler
102See the man pages for mono(1), mcs(1) and monodis(1) for further details.
107* `data/` - Configuration files installed as part of the Mono runtime.
109* `docs/` - Technical documents about the Mono runtime.
111* `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
113* `man/` - Manual pages for the various Mono commands and programs.
115* `mcs/` - The class libraries, compiler and tools
117 * `class/` - The class libraries (like System.*, Microsoft.Build, etc.)
119 * `mcs/` - The Mono C# compiler written in C#
121 * `tools/` - Tools like gacutil, ikdasm, mdoc, etc.
123* `mono/` - The core of the Mono Runtime.
125 * `arch/` - Architecture specific portions.
127 * `cil/` - Common Intermediate Representation, XML
128definition of the CIL bytecodes.
130 * `dis/` - CIL executable Disassembler
132 * `io-layer/` - The I/O layer and system abstraction for
133emulating the .NET IO model.
135 * `metadata/` - The object system and metadata reader.
137 * `mini/` - The Just in Time Compiler.
139* `runtime/` - A directory that contains the Makefiles that link the
140mono/ and mcs/ build systems.
142* `samples/` -Some simple sample programs on uses of the Mono
143runtime as an embedded library.
145* `scripts/` - Scripts used to invoke Mono and the corresponding program.
147Contributing to Mono
150Before submitting changes to Mono, please review the [contribution
152Please pay particular attention to the [Important
159To submit bug reports, please use [Xamarin's
162Please use the search facility to ensure the same bug hasn't already
163been submitted and follow our
165on how to make a good bug report.
170The following are the configuration options that someone building Mono
171might want to use:
173* `--with-sgen=yes,no` - Generational GC support: Used to enable or
174disable the compilation of a Mono runtime with the SGen garbage
177 * On platforms that support it, after building Mono, you will have
178both a `mono` binary and a `mono-sgen` binary. `mono` uses Boehm,
179while `mono-sgen` uses the Simple Generational GC.
181* `--with-gc=[included, boehm, none]` - Selects the default Boehm
182garbage collector engine to use.
184 * *included*: (*slighty modified Boehm GC*) This is the default
185value for the Boehm GC, and it's the most feature complete, it will
186allow Mono to use typed allocations and support the debugger.
188 * *boehm*: This is used to use a system-install Boehm GC, it is
189useful to test new features available in Boehm GC, but we do not
190recommend that people use this, as it disables a few features.
192 * *none*:
193Disables the inclusion of a garbage collector.
195 * This defaults to `included`.
199 * Controls how Mono should access thread local storage,
200pthread forces Mono to use the pthread APIs, while
201__thread uses compiler-optimized access to it.
203 * Although __thread is faster, it requires support from
204the compiler, kernel and libc. Old Linux systems do
205not support with __thread.
207 * This value is typically pre-configured and there is no
208need to set it, unless you are trying to debug a problem.
212 * **Experimental**: Use at your own risk, it is known to
213cause problems with garbage collection and is hard to
214reproduce those bugs.
216 * This controls whether Mono will install a special
217signal handler to handle stack overflows. If set to
218`yes`, it will turn stack overflows into the
219StackOverflowException. Otherwise when a stack
220overflow happens, your program will receive a
223 * The configure script will try to detect if your
224operating system supports this. Some older Linux
225systems do not support this feature, or you might want
226to override the auto-detection.
230 * This controls whether `mono` should link against a
231static library (libmono.a) or a shared library
234 * This defaults to `yes`, and will improve the performance
235of the `mono` program.
237 * This only affects the `mono' binary, the shared
238library libmono.so will always be produced for
239developers that want to embed the runtime in their
242* `--with-xen-opt=yes,no` - Optimize code for Xen virtualization.
244 * It makes Mono generate code which might be slightly
245slower on average systems, but the resulting executable will run
246faster under the Xen virtualization system.
248 * This defaults to `yes`.
250* `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
252 * This defaults to `no`.
254* `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
255and disk footprint at the expense of some capabilities.
257 * Typically this means that the number of threads that can be created
258is limited (256), that the maximum heap size is also reduced (256 MB)
259and other such limitations that still make mono useful, but more suitable
260to embedded devices (like mobile phones).
262 * This defaults to `no`.
264* `--with-ikvm-native=yes,no` - Controls whether the IKVM JNI interface library is
265built or not.
267 * This is used if you are planning on
268using the IKVM Java Virtual machine with Mono.
270 * This defaults to `yes`.
272* `--with-profile4=yes,no` - Whether you want to build the 4.x profile libraries
275 * This defaults to `yes`.
277* `--with-libgdiplus=installed,sibling,<path>` - Configure where Mono
278searches for libgdiplus when running System.Drawing tests.
280 * It defaults to `installed`, which means that the
281library is available to Mono through the regular
284 * `sibling` can be used to specify that a libgdiplus
285that resides as a sibling of this directory (mono)
286should be used.
288 * Or you can specify a path to a libgdiplus.
292 * Use this option to disable the use of shared memory in
293Mono (this is equivalent to setting the MONO_DISABLE_SHM
294environment variable, although this removes the feature
297 * Disabling the shared memory support will disable certain
298features like cross-process named mutexes.
302 * Use this feature to specify optional runtime
303components that you might not want to include. This
304is only useful for developers embedding Mono that
305require a subset of Mono functionality.
306 * The list is a comma-separated list of components that
307should be removed, these are:
309 * `aot`:
310Disables support for the Ahead of Time compilation.
312 * `attach`:
313Support for the Mono.Management assembly and the
314VMAttach API (allowing code to be injected into
315a target VM)
317 * `com`:
318Disables COM support.
320 * `debug`:
321Drop debugging support.
323 * `decimal`:
324Disables support for System.Decimal.
326 * `full_messages`:
327By default Mono comes with a full table
328of messages for error codes. This feature
329turns off uncommon error messages and reduces
330the runtime size.
332 * `generics`:
333Generics support. Disabling this will not
334allow Mono to run any 2.0 libraries or
335code that contains generics.
337 * `jit`:
338Removes the JIT engine from the build, this reduces
339the executable size, and requires that all code
340executed by the virtual machine be compiled with
341Full AOT before execution.
343 * `large_code`:
344Disables support for large assemblies.
346 * `logging`:
347Disables support for debug logging.
349 * `pinvoke`:
350Support for Platform Invocation services,
351disabling this will drop support for any
352libraries using DllImport.
354 * `portability`:
355Removes support for MONO_IOMAP, the environment
356variables for simplifying porting applications that
357are case-insensitive and that mix the Unix and Windows path separators.
359 * `profiler`:
360Disables support for the default profiler.
362 * `reflection_emit`:
363Drop System.Reflection.Emit support
365 * `reflection_emit_save`:
366Drop support for saving dynamically created
367assemblies (AssemblyBuilderAccess.Save) in
370 * `shadow_copy`:
371Disables support for AppDomain's shadow copies
372(you can disable this if you do not plan on
375 * `simd`:
376Disables support for the Mono.SIMD intrinsics
379 * `ssa`:
380Disables compilation for the SSA optimization
381framework, and the various SSA-based optimizations.
386 * This enables the use of LLVM as a code generation engine
387for Mono. The LLVM code generator and optimizer will be
388used instead of Mono's built-in code generator for both
389Just in Time and Ahead of Time compilations.
391 * See http://www.mono-project.com/docs/advanced/mono-llvm/ for the
392full details and up-to-date information on this feature.
394 * You will need to have an LLVM built that Mono can link
397 * The `--enable-loadedllvm` variant will make the LLVM backend
398into a runtime-loadable module instead of linking it directly
399into the main mono binary.
401* `--enable-big-arrays` - Enable use of arrays with indexes larger
404 * By default Mono has the same limitation as .NET on
405Win32 and Win64 and limits array indexes to 32-bit
406values (even on 64-bit systems).
408 * In certain scenarios where large arrays are required,
409you can pass this flag and Mono will be built to
410support 64-bit arrays.
412 * This is not the default as it breaks the C embedding
413ABI that we have exposed through the Mono development
418 * Use this option to enable the garbage collector to use
419multiple CPUs to do its work. This helps performance
420on multi-CPU machines as the work is divided across CPUS.
422 * This option is not currently the default as we have
423not done much testing with Mono.
427 * On Solaris and MacOS X builds a version of the Mono
428runtime that contains DTrace probes and can
429participate in the system profiling using DTrace.
433 * Mono uses /dev/random to obtain good random data for
434any source that requires random numbers. If your
435system does not support this, you might want to
438 * There are a number of runtime options to control this
439also, see the man page.
443 * This configures the Mono compiler to generate code
444suitable to be used by Google's Native Client:
447 * Currently this is used with Mono's AOT engine as
448Native Client does not support JIT engines yet.
450Working With Submodules
453Mono references several external git submodules, for example
454a fork of Microsoft's reference source code that has been altered
455to be suitable for use with the Mono runtime.
457This section describes how to use it.
459An initial clone should be done recursively so all submodules will also be
460cloned in a single pass:
462 $ git clone --recursive email@example.com:mono/mono
464Once cloned, submodules can be updated to pull down the latest changes.
465This can also be done after an initial non-recursive clone:
467 $ git submodule update --init --recursive
469To pull external changes into a submodule:
471 $ cd <submodule>
472 $ git pull origin <branch>
473 $ cd <top-level>
474 $ git add <submodule>
475 $ git commit
477By default, submodules are detached because they point to a specific commit.
478Use `git checkout` to move back to a branch before making changes:
480 $ cd <submodule>
481 $ git checkout <branch>
482 # work as normal; the submodule is a normal repo
483 $ git commit/push new changes to the repo (submodule)
485 $ cd <top-level>
486 $ git add <submodule> # this will record the new commits to the submodule
487 $ git commit
489To switch the repo of a submodule (this should not be a common or normal thing
490to do at all), first edit `.gitmodules` to point to the new location, then:
492 $ git submodule sync -- <path of the submodule>
493 $ git submodule update --recursive
494 $ git checkout <desired new hash or branch>
496The desired output diff is a change in `.gitmodules` to reflect the
497change in the remote URL, and a change in /<submodule> where you see
498the desired change in the commit hash.