1 Mono is a software platform designed to allow developers to easily
2 create cross platform applications. It is an open source
3 implementation of Microsoft's .NET Framework based on the ECMA
4 standards for C# and the Common Language Runtime.
6 The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.org/)
8 [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mono/mono?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
10 1. [Compilation and Installation](#compilation-and-installation)
11 2. [Using Mono](#using-mono)
12 3. [Directory Roadmap](#directory-roadmap)
13 4. [Contributing to Mono](#contributing-to-mono)
14 5. [Reporting bugs](#reporting-bugs)
15 6. [Configuration Options](#configuration-options)
16 7. [Working with Submodules](#working-with-submodules)
20 | OS | Architecture | Status |
21 |--------------|--------------------|------------------------------|
22 | Ubuntu 14.04 | amd64 | [![ubuntu-1404-amd64][1]][2] |
23 | Ubuntu 14.04 | i386 | [![ubuntu-1404-i386][3]][4] |
24 | Debian 8 | armel | [![debian-8-armel][5]][6] |
25 | Debian 8 | armhf | [![debian-8-armhf][7]][8] |
26 | Debian 8 | arm64 | [![debian-8-arm64][9]][10] |
27 | OS X | amd64 | [![osx-amd64][11]][12] |
28 | OS X | i386 | [![osx-i386][13]][14] |
29 | Windows | amd64 | [![windows-amd64][15]][16] |
30 | Windows | i386 | [![windows-amd64][17]][18] |
31 | CentOS | s390x (cs) | [![centos-s390x][19]][20] |
33 _(cs) = community supported architecture_
35 [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64/badge/icon
36 [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64
37 [3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/badge/icon
38 [4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/
39 [5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/badge/icon
40 [6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/
41 [7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/badge/icon
42 [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/
43 [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/badge/icon
44 [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/
45 [11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
46 [12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
47 [13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
48 [14]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/
49 [15]: https://jenkins.mono-project.com/job/z/label=w64/badge/icon
50 [16]: https://jenkins.mono-project.com/job/z/label=w64/
51 [17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon
52 [18]: https://jenkins.mono-project.com/job/z/label=w32/
53 [19]: https://jenkins.mono-project.com/job/z/label=centos-s390x/badge/icon
54 [20]: https://jenkins.mono-project.com/job/z/label=centos-s390x
56 Compilation and Installation
57 ============================
62 Please see our guides for building Mono on
63 [Mac OS X](http://www.mono-project.com/docs/compiling-mono/mac/),
64 [Linux](http://www.mono-project.com/docs/compiling-mono/linux/) and
65 [Windows](http://www.mono-project.com/docs/compiling-mono/windows/).
67 Note that building from Git assumes that you already have Mono installed,
68 so please download and [install the latest Mono release](http://www.mono-project.com/download/)
69 before trying to build from Git. This is required because the Mono build
70 relies on a working Mono C# compiler to compile itself
71 (also known as [bootstrapping](http://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
73 If you don't have a working Mono installation
74 ---------------------------------------------
76 If you don't have a working Mono installation, you can try a slightly
77 more risky approach: getting the latest version of the 'monolite' distribution,
78 which contains just enough to run the 'mcs' compiler. You do this with:
80 # Run the following line after ./autogen.sh
81 make get-monolite-latest
83 This will download and place the files appropriately so that you can then
88 The build will then use the files downloaded by `make get-monolite-latest`.
90 Testing and Installation
91 ------------------------
93 You can run the mono and mcs test suites with the command: `make check`.
95 Expect to find a few test suite failures. As a sanity check, you
96 can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
98 You can now install mono with: `make install`
100 You can verify your installation by using the mono-test-install
101 script, it can diagnose some common problems with Mono's install.
102 Failure to follow these steps may result in a broken installation.
107 Once you have installed the software, you can run a few programs:
109 * `mono program.exe` runtime engine
111 * `mcs program.cs` C# compiler
113 * `monodis program.exe` CIL Disassembler
115 See the man pages for mono(1), mcs(1) and monodis(1) for further details.
120 * `acceptance-tests/` - Optional third party test suites used to validate Mono against a wider range of test cases.
122 * `data/` - Configuration files installed as part of the Mono runtime.
124 * `docs/` - Technical documents about the Mono runtime.
126 * `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
128 * `man/` - Manual pages for the various Mono commands and programs.
130 * `mcs/` - The class libraries, compiler and tools
132 * `class/` - The class libraries (like System.*, Microsoft.Build, etc.)
134 * `mcs/` - The Mono C# compiler written in C#
136 * `tools/` - Tools like gacutil, ikdasm, mdoc, etc.
138 * `mono/` - The core of the Mono Runtime.
140 * `arch/` - Architecture specific portions.
142 * `cil/` - Common Intermediate Representation, XML
143 definition of the CIL bytecodes.
145 * `dis/` - CIL executable Disassembler
147 * `io-layer/` - The I/O layer and system abstraction for
148 emulating the .NET IO model.
150 * `metadata/` - The object system and metadata reader.
152 * `mini/` - The Just in Time Compiler.
154 * `runtime/` - A directory that contains the Makefiles that link the
155 mono/ and mcs/ build systems.
157 * `samples/` -Some simple sample programs on uses of the Mono
158 runtime as an embedded library.
160 * `scripts/` - Scripts used to invoke Mono and the corresponding program.
165 Before submitting changes to Mono, please review the [contribution
166 guidelines](http://www.mono-project.com/community/contributing/).
167 Please pay particular attention to the [Important
168 Rules](http://www.mono-project.com/community/contributing/#important-rules)
174 To submit bug reports, please use [Xamarin's
175 Bugzilla](https://bugzilla.xamarin.com/)
177 Please use the search facility to ensure the same bug hasn't already
178 been submitted and follow our
179 [guidelines](http://www.mono-project.com/community/bugs/make-a-good-bug-report/)
180 on how to make a good bug report.
182 Configuration Options
183 =====================
185 The following are the configuration options that someone building Mono
188 * `--with-sgen=yes,no` - Generational GC support: Used to enable or
189 disable the compilation of a Mono runtime with the SGen garbage
192 * On platforms that support it, after building Mono, you will have
193 both a `mono` binary and a `mono-sgen` binary. `mono` uses Boehm,
194 while `mono-sgen` uses the Simple Generational GC.
196 * `--with-gc=[included, boehm, none]` - Selects the default Boehm
197 garbage collector engine to use.
199 * *included*: (*slightly modified Boehm GC*) This is the default
200 value for the Boehm GC, and it's the most feature complete, it will
201 allow Mono to use typed allocations and support the debugger.
203 * *boehm*: This is used to use a system-install Boehm GC, it is
204 useful to test new features available in Boehm GC, but we do not
205 recommend that people use this, as it disables a few features.
208 Disables the inclusion of a garbage collector.
210 * This defaults to `included`.
212 * `--with-cooperative-gc`
214 * If you pass this flag the Mono runtime is configured to only use
215 the cooperative mode of the garbage collector. If you do not pass
216 this flag, then you can control at runtime the use of the
217 cooperative GC mode by setting the `MONO_ENABLE_COOP` flag.
219 * `--with-tls=__thread,pthread`
221 * Controls how Mono should access thread local storage,
222 pthread forces Mono to use the pthread APIs, while
223 __thread uses compiler-optimized access to it.
225 * Although __thread is faster, it requires support from
226 the compiler, kernel and libc. Old Linux systems do
227 not support with __thread.
229 * This value is typically pre-configured and there is no
230 need to set it, unless you are trying to debug a problem.
232 * `--with-sigaltstack=yes,no`
234 * **Experimental**: Use at your own risk, it is known to
235 cause problems with garbage collection and is hard to
236 reproduce those bugs.
238 * This controls whether Mono will install a special
239 signal handler to handle stack overflows. If set to
240 `yes`, it will turn stack overflows into the
241 StackOverflowException. Otherwise when a stack
242 overflow happens, your program will receive a
245 * The configure script will try to detect if your
246 operating system supports this. Some older Linux
247 systems do not support this feature, or you might want
248 to override the auto-detection.
250 * `--with-static_mono=yes,no`
252 * This controls whether `mono` should link against a
253 static library (libmono.a) or a shared library
256 * This defaults to `yes`, and will improve the performance
257 of the `mono` program.
259 * This only affects the `mono' binary, the shared
260 library libmono.so will always be produced for
261 developers that want to embed the runtime in their
264 * `--with-xen-opt=yes,no` - Optimize code for Xen virtualization.
266 * It makes Mono generate code which might be slightly
267 slower on average systems, but the resulting executable will run
268 faster under the Xen virtualization system.
270 * This defaults to `yes`.
272 * `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
274 * This defaults to `no`.
276 * `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
277 and disk footprint at the expense of some capabilities.
279 * Typically this means that the number of threads that can be created
280 is limited (256), that the maximum heap size is also reduced (256 MB)
281 and other such limitations that still make mono useful, but more suitable
282 to embedded devices (like mobile phones).
284 * This defaults to `no`.
286 * `--with-ikvm-native=yes,no` - Controls whether the IKVM JNI interface library is
289 * This is used if you are planning on
290 using the IKVM Java Virtual machine with Mono.
292 * This defaults to `yes`.
294 * `--with-profile4=yes,no` - Whether you want to build the 4.x profile libraries
297 * This defaults to `yes`.
299 * `--with-libgdiplus=installed,sibling,<path>` - Configure where Mono
300 searches for libgdiplus when running System.Drawing tests.
302 * It defaults to `installed`, which means that the
303 library is available to Mono through the regular
306 * `sibling` can be used to specify that a libgdiplus
307 that resides as a sibling of this directory (mono)
310 * Or you can specify a path to a libgdiplus.
312 * `--disable-shared-memory`
314 * Use this option to disable the use of shared memory in
315 Mono (this is equivalent to setting the MONO_DISABLE_SHM
316 environment variable, although this removes the feature
319 * Disabling the shared memory support will disable certain
320 features like cross-process named mutexes.
322 * `--enable-minimal=LIST`
324 * Use this feature to specify optional runtime
325 components that you might not want to include. This
326 is only useful for developers embedding Mono that
327 require a subset of Mono functionality.
328 * The list is a comma-separated list of components that
329 should be removed, these are:
332 Disables support for the Ahead of Time compilation.
335 Support for the Mono.Management assembly and the
336 VMAttach API (allowing code to be injected into
340 Disables COM support.
343 Drop debugging support.
346 Disables support for System.Decimal.
349 By default Mono comes with a full table
350 of messages for error codes. This feature
351 turns off uncommon error messages and reduces
355 Generics support. Disabling this will not
356 allow Mono to run any 2.0 libraries or
357 code that contains generics.
360 Removes the JIT engine from the build, this reduces
361 the executable size, and requires that all code
362 executed by the virtual machine be compiled with
363 Full AOT before execution.
366 Disables support for large assemblies.
369 Disables support for debug logging.
372 Support for Platform Invocation services,
373 disabling this will drop support for any
374 libraries using DllImport.
377 Removes support for MONO_IOMAP, the environment
378 variables for simplifying porting applications that
379 are case-insensitive and that mix the Unix and Windows path separators.
382 Disables support for the default profiler.
385 Drop System.Reflection.Emit support
387 * `reflection_emit_save`:
388 Drop support for saving dynamically created
389 assemblies (AssemblyBuilderAccess.Save) in
390 System.Reflection.Emit.
393 Disables support for AppDomain's shadow copies
394 (you can disable this if you do not plan on
398 Disables support for the Mono.SIMD intrinsics
402 Disables compilation for the SSA optimization
403 framework, and the various SSA-based optimizations.
406 * `--enable-loadedllvm`
408 * This enables the use of LLVM as a code generation engine
409 for Mono. The LLVM code generator and optimizer will be
410 used instead of Mono's built-in code generator for both
411 Just in Time and Ahead of Time compilations.
413 * See http://www.mono-project.com/docs/advanced/mono-llvm/ for the
414 full details and up-to-date information on this feature.
416 * You will need to have an LLVM built that Mono can link
419 * The `--enable-loadedllvm` variant will make the LLVM backend
420 into a runtime-loadable module instead of linking it directly
421 into the main mono binary.
423 * `--enable-big-arrays` - Enable use of arrays with indexes larger
426 * By default Mono has the same limitation as .NET on
427 Win32 and Win64 and limits array indexes to 32-bit
428 values (even on 64-bit systems).
430 * In certain scenarios where large arrays are required,
431 you can pass this flag and Mono will be built to
432 support 64-bit arrays.
434 * This is not the default as it breaks the C embedding
435 ABI that we have exposed through the Mono development
438 * `--enable-parallel-mark`
440 * Use this option to enable the garbage collector to use
441 multiple CPUs to do its work. This helps performance
442 on multi-CPU machines as the work is divided across CPUS.
444 * This option is not currently the default on OSX
445 as it runs into issues there.
447 * This option only applies to the Boehm GC.
451 * On Solaris and MacOS X builds a version of the Mono
452 runtime that contains DTrace probes and can
453 participate in the system profiling using DTrace.
455 * `--disable-dev-random`
457 * Mono uses /dev/random to obtain good random data for
458 any source that requires random numbers. If your
459 system does not support this, you might want to
462 * There are a number of runtime options to control this
463 also, see the man page.
465 * `--with-csc=roslyn,mcs,default`
467 * Use this option to configure which C# compiler to use. By default
468 the configure script will pick Roslyn, except on platforms where
469 Roslyn does not work (Big Endian systems) where it will pick mcs.
471 If you specify "mcs", then Mono's C# compiler will be used. This
472 also allows for a complete bootstrap of Mono's core compiler and
473 core libraries from source.
475 If you specify "roslyn", then Roslyn's C# compiler will be used.
476 This currently uses Roslyn binaries.
480 * This configures the Mono compiler to generate code
481 suitable to be used by Google's Native Client:
482 http://code.google.com/p/nativeclient/
484 * Currently this is used with Mono's AOT engine as
485 Native Client does not support JIT engines yet.
487 Working With Submodules
488 =======================
490 Mono references several external git submodules, for example
491 a fork of Microsoft's reference source code that has been altered
492 to be suitable for use with the Mono runtime.
494 This section describes how to use it.
496 An initial clone should be done recursively so all submodules will also be
497 cloned in a single pass:
499 $ git clone --recursive git@github.com:mono/mono
501 Once cloned, submodules can be updated to pull down the latest changes.
502 This can also be done after an initial non-recursive clone:
504 $ git submodule update --init --recursive
506 To pull external changes into a submodule:
509 $ git pull origin <branch>
511 $ git add <submodule>
514 By default, submodules are detached because they point to a specific commit.
515 Use `git checkout` to move back to a branch before making changes:
518 $ git checkout <branch>
519 # work as normal; the submodule is a normal repo
520 $ git commit/push new changes to the repo (submodule)
523 $ git add <submodule> # this will record the new commits to the submodule
526 To switch the repo of a submodule (this should not be a common or normal thing
527 to do at all), first edit `.gitmodules` to point to the new location, then:
529 $ git submodule sync -- <path of the submodule>
530 $ git submodule update --recursive
531 $ git checkout <desired new hash or branch>
533 The desired output diff is a change in `.gitmodules` to reflect the
534 change in the remote URL, and a change in /<submodule> where you see
535 the desired change in the commit hash.
540 See the LICENSE file for licensing information, and the PATENTS.TXT
541 file for information about Microsoft's patent grant.
543 Mono Trademark Use Policy
544 =========================
546 The use of trademarks and logos for Mono can be found [here] (http://www.dotnetfoundation.org/legal/mono-tm).
548 Maintaining the Class Library Solution Files
549 ============================================
551 Mono now ships with a solution file that can be used to build the
552 assemblies from an IDE. Either by opening the topmost `net_4_x.sln`
553 file, or to by loading one of the individual `csproj` files located in
556 These are maintained by extracting the configuration information from
557 our Makefiles, which as of May 2016 remain the canonical location for
558 configuration information.
560 When changes are made to the Makefiles, a user would need to run the
561 following command to re-generate the solution files at the top level:
563 $ make update-solution-files