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](https://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 | Debian 9 | amd64 | [![debian-9-amd64][1]][2] |
23 | Debian 9 | i386 | [![debian-9-i386][3]][4] |
24 | Debian 9 | armel | [![debian-9-armel][5]][6] |
25 | Debian 9 | armhf | [![debian-9-armhf][7]][8] |
26 | Debian 9 | arm64 | [![debian-9-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-i386][17]][18] |
31 | CentOS | s390x (cs) | [![centos-s390x][19]][20] |
32 | Debian 9 | ppc64el (cs) | [![debian-9-ppc64el][21]][22]|
33 | AIX | ppc64 (cs) | [![aix-ppc64][23]][24] |
35 _(cs) = community supported architecture_
37 [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64/badge/icon
38 [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64
39 [3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/badge/icon
40 [4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/
41 [5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/badge/icon
42 [6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/
43 [7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/badge/icon
44 [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/
45 [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/badge/icon
46 [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/
47 [11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
48 [12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
49 [13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
50 [14]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/
51 [15]: https://jenkins.mono-project.com/job/z/label=w64/badge/icon
52 [16]: https://jenkins.mono-project.com/job/z/label=w64/
53 [17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon
54 [18]: https://jenkins.mono-project.com/job/z/label=w32/
55 [19]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x/badge/icon
56 [20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x
57 [21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el/badge/icon
58 [22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el
59 [23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon
60 [24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64
62 Compilation and Installation
63 ============================
68 Please see our guides for building Mono on
69 [Mac OS X](https://www.mono-project.com/docs/compiling-mono/mac/),
70 [Linux](https://www.mono-project.com/docs/compiling-mono/linux/) and
71 [Windows](https://www.mono-project.com/docs/compiling-mono/windows/).
73 Note that building from Git assumes that you already have Mono installed,
74 so please download and [install the latest Mono release](https://www.mono-project.com/download/)
75 before trying to build from Git. This is required because the Mono build
76 relies on a working Mono C# compiler to compile itself
77 (also known as [bootstrapping](https://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
79 If you don't have a working Mono installation
80 ---------------------------------------------
82 If you don't have a working Mono installation, you can try a slightly
83 more risky approach: getting the latest version of the 'monolite' distribution,
84 which contains just enough to run the 'mcs' compiler. You do this with:
86 # Run the following line after ./autogen.sh
87 make get-monolite-latest
89 This will download and place the files appropriately so that you can then
94 The build will then use the files downloaded by `make get-monolite-latest`.
96 Testing and Installation
97 ------------------------
99 You can run the mono and mcs test suites with the command: `make check`.
101 Expect to find a few test suite failures. As a sanity check, you
102 can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
104 You can now install mono with: `make install`
106 You can verify your installation by using the mono-test-install
107 script, it can diagnose some common problems with Mono's install.
108 Failure to follow these steps may result in a broken installation.
113 Once you have installed the software, you can run a few programs:
115 * `mono program.exe` runtime engine
117 * `mcs program.cs` C# compiler
119 * `monodis program.exe` CIL Disassembler
121 See the man pages for mono(1), mcs(1) and monodis(1) for further details.
126 * `acceptance-tests/` - Optional third party test suites used to validate Mono against a wider range of test cases.
128 * `data/` - Configuration files installed as part of the Mono runtime.
130 * `docs/` - Technical documents about the Mono runtime.
132 * `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
134 * `ikvm-native/` - Glue code for ikvm.
136 * `libgc/` - The (deprecated) Boehm GC implementation.
138 * `llvm/` - Utility Makefiles for integrating the Mono LLVM fork.
140 * `m4/` - General utility Makefiles.
142 * `man/` - Manual pages for the various Mono commands and programs.
144 * `mcs/` - The class libraries, compiler and tools
146 * `class/` - The class libraries (like System.*, Microsoft.Build, etc.)
148 * `mcs/` - The Mono C# compiler written in C#
150 * `tools/` - Tools like gacutil, ikdasm, mdoc, etc.
152 * `mono/` - The core of the Mono Runtime.
154 * `arch/` - Architecture specific portions.
156 * `benchmark/` - A collection of benchmarks.
158 * `btls/` - Build files for the BTLS library which incorporates BoringSSL.
160 * `cil/` - Common Intermediate Representation, XML
161 definition of the CIL bytecodes.
163 * `dis/` - CIL executable Disassembler.
165 * `eglib/` - Independent implementation of the glib API.
167 * `metadata/` - The object system and metadata reader.
169 * `mini/` - The Just in Time Compiler.
171 * `profiler/` - The profiler implementation.
173 * `sgen/` - The SGen Garbage Collector implementation.
175 * `tests/` - The main runtime tests.
177 * `unit-tests/` - Additional runtime unit tests.
179 * `utils/` - Utility functions used across the runtime codebase.
181 * `msvc/` - Logic for the MSVC / Visual Studio based runtime and BCL build system.
182 The latter is experimental at the moment.
184 * `packaging/` - Packaging logic for the OS X and Windows Mono packages.
186 * `po/` - Translation files.
188 * `runtime/` - A directory that contains the Makefiles that link the
189 mono/ and mcs/ build systems.
191 * `samples/` - Some simple sample programs on uses of the Mono
192 runtime as an embedded library.
194 * `scripts/` - Scripts used to invoke Mono and the corresponding program.
196 * `sdks/` - A new way of embedding Mono into Xamarin.iOS, Xamarin.Android and other products.
198 * `support/` - Various support libraries.
200 * `tools/` - A collection of tools, mostly used during Mono development.
205 Before submitting changes to Mono, please review the [contribution
206 guidelines](https://www.mono-project.com/community/contributing/).
207 Please pay particular attention to the [Important
208 Rules](https://www.mono-project.com/community/contributing/#important-rules)
214 To submit bug reports, please [open an issue on the mono GitHub repo](https://github.com/mono/mono/issues/new).
216 Please use the search facility to ensure the same bug hasn't already
217 been submitted and follow our
218 [guidelines](https://www.mono-project.com/community/bugs/make-a-good-bug-report/)
219 on how to make a good bug report.
221 Configuration Options
222 =====================
224 The following are the configuration options that someone building Mono
227 * `--with-sgen=yes,no` - Generational GC support: Used to enable or
228 disable the compilation of a Mono runtime with the SGen garbage
231 * On platforms that support it, after building Mono, you will have
232 both a `mono-boehm` binary and a `mono-sgen` binary. `mono-boehm` uses Boehm,
233 while `mono-sgen` uses the Simple Generational GC.
235 * `--with-libgc=[included, none]` - Selects the default Boehm
236 garbage collector engine to use.
238 * *included*: (*slightly modified Boehm GC*) This is the default
239 value for the Boehm GC, and it's the most feature complete, it will
240 allow Mono to use typed allocations and support the debugger.
243 Disables the inclusion of a Boehm garbage collector.
245 * This defaults to `included`.
247 * `--enable-cooperative-suspend`
249 * If you pass this flag the Mono runtime is configured to only use
250 the cooperative mode of the garbage collector. If you do not pass
251 this flag, then you can control at runtime the use of the
252 cooperative GC mode by setting the `MONO_ENABLE_COOP_SUSPEND` flag.
254 * `--with-tls=__thread,pthread`
256 * Controls how Mono should access thread local storage,
257 pthread forces Mono to use the pthread APIs, while
258 __thread uses compiler-optimized access to it.
260 * Although __thread is faster, it requires support from
261 the compiler, kernel and libc. Old Linux systems do
262 not support with __thread.
264 * This value is typically pre-configured and there is no
265 need to set it, unless you are trying to debug a problem.
267 * `--with-sigaltstack=yes,no`
269 * **Experimental**: Use at your own risk, it is known to
270 cause problems with garbage collection and is hard to
271 reproduce those bugs.
273 * This controls whether Mono will install a special
274 signal handler to handle stack overflows. If set to
275 `yes`, it will turn stack overflows into the
276 StackOverflowException. Otherwise when a stack
277 overflow happens, your program will receive a
280 * The configure script will try to detect if your
281 operating system supports this. Some older Linux
282 systems do not support this feature, or you might want
283 to override the auto-detection.
285 * `--with-static_mono=yes,no`
287 * This controls whether `mono` should link against a
288 static library (libmono.a) or a shared library
291 * This defaults to `yes`, and will improve the performance
292 of the `mono` program.
294 * This only affects the `mono' binary, the shared
295 library libmono.so will always be produced for
296 developers that want to embed the runtime in their
299 * `--with-xen-opt=yes,no` - Optimize code for Xen virtualization.
301 * It makes Mono generate code which might be slightly
302 slower on average systems, but the resulting executable will run
303 faster under the Xen virtualization system.
305 * This defaults to `yes`.
307 * `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
309 * This defaults to `no`.
311 * `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
312 and disk footprint at the expense of some capabilities.
314 * Typically this means that the number of threads that can be created
315 is limited (256), that the maximum heap size is also reduced (256 MB)
316 and other such limitations that still make mono useful, but more suitable
317 to embedded devices (like mobile phones).
319 * This defaults to `no`.
321 * `--with-ikvm-native=yes,no` - Controls whether the IKVM JNI interface library is
324 * This is used if you are planning on
325 using the IKVM Java Virtual machine with Mono.
327 * This defaults to `yes`.
329 * `--with-profile4=yes,no` - Whether you want to build the 4.x profile libraries
332 * This defaults to `yes`.
334 * `--with-libgdiplus=installed,sibling,<path>` - Configure where Mono
335 searches for libgdiplus when running System.Drawing tests.
337 * It defaults to `installed`, which means that the
338 library is available to Mono through the regular
341 * `sibling` can be used to specify that a libgdiplus
342 that resides as a sibling of this directory (mono)
345 * Or you can specify a path to a libgdiplus.
347 * `--enable-minimal=LIST`
349 * Use this feature to specify optional runtime
350 components that you might not want to include. This
351 is only useful for developers embedding Mono that
352 require a subset of Mono functionality.
353 * The list is a comma-separated list of components that
354 should be removed, these are:
357 Disables support for the Ahead of Time compilation.
360 Support for the Mono.Management assembly and the
361 VMAttach API (allowing code to be injected into
365 Disables COM support.
368 Drop debugging support.
371 Disables support for System.Decimal.
374 By default Mono comes with a full table
375 of messages for error codes. This feature
376 turns off uncommon error messages and reduces
380 Generics support. Disabling this will not
381 allow Mono to run any 2.0 libraries or
382 code that contains generics.
385 Removes the JIT engine from the build, this reduces
386 the executable size, and requires that all code
387 executed by the virtual machine be compiled with
388 Full AOT before execution.
391 Disables support for large assemblies.
394 Disables support for debug logging.
397 Support for Platform Invocation services,
398 disabling this will drop support for any
399 libraries using DllImport.
402 Removes support for MONO_IOMAP, the environment
403 variables for simplifying porting applications that
404 are case-insensitive and that mix the Unix and Windows path separators.
407 Disables support for the default profiler.
410 Drop System.Reflection.Emit support
412 * `reflection_emit_save`:
413 Drop support for saving dynamically created
414 assemblies (AssemblyBuilderAccess.Save) in
415 System.Reflection.Emit.
418 Disables support for AppDomain's shadow copies
419 (you can disable this if you do not plan on
423 Disables support for the Mono.SIMD intrinsics
427 Disables compilation for the SSA optimization
428 framework, and the various SSA-based optimizations.
431 * `--enable-loadedllvm`
433 * This enables the use of LLVM as a code generation engine
434 for Mono. The LLVM code generator and optimizer will be
435 used instead of Mono's built-in code generator for both
436 Just in Time and Ahead of Time compilations.
438 * See https://www.mono-project.com/docs/advanced/mono-llvm/ for the
439 full details and up-to-date information on this feature.
441 * You will need to have an LLVM built that Mono can link
444 * The `--enable-loadedllvm` variant will make the LLVM backend
445 into a runtime-loadable module instead of linking it directly
446 into the main mono binary.
448 * `--enable-big-arrays` - Enable use of arrays with indexes larger
451 * By default Mono has the same limitation as .NET on
452 Win32 and Win64 and limits array indexes to 32-bit
453 values (even on 64-bit systems).
455 * In certain scenarios where large arrays are required,
456 you can pass this flag and Mono will be built to
457 support 64-bit arrays.
459 * This is not the default as it breaks the C embedding
460 ABI that we have exposed through the Mono development
463 * `--enable-parallel-mark`
465 * Use this option to enable the garbage collector to use
466 multiple CPUs to do its work. This helps performance
467 on multi-CPU machines as the work is divided across CPUS.
469 * This option is not currently the default on OSX
470 as it runs into issues there.
472 * This option only applies to the Boehm GC.
476 * On Solaris and MacOS X builds a version of the Mono
477 runtime that contains DTrace probes and can
478 participate in the system profiling using DTrace.
480 * `--disable-dev-random`
482 * Mono uses /dev/random to obtain good random data for
483 any source that requires random numbers. If your
484 system does not support this, you might want to
487 * There are a number of runtime options to control this
488 also, see the man page.
490 * `--with-csc=roslyn,mcs,default`
492 * Use this option to configure which C# compiler to use. By default
493 the configure script will pick Roslyn, except on platforms where
494 Roslyn does not work (Big Endian systems) where it will pick mcs.
496 If you specify "mcs", then Mono's C# compiler will be used. This
497 also allows for a complete bootstrap of Mono's core compiler and
498 core libraries from source.
500 If you specify "roslyn", then Roslyn's C# compiler will be used.
501 This currently uses Roslyn binaries.
505 * This configures the Mono compiler to generate code
506 suitable to be used by Google's Native Client:
507 https://code.google.com/p/nativeclient/
509 * Currently this is used with Mono's AOT engine as
510 Native Client does not support JIT engines yet.
514 * Use this option to configure mono to run on WebAssembly. It will
515 set both host and target to the WebAssembly triplet. This overrides
516 the values passed to `--host` or `--target` and ignored what config.sub guesses.
518 This is a workaround to enable usage of old automake versions that don't
519 recognize the wasm triplet.
522 Working With Submodules
523 =======================
525 Mono references several external git submodules, for example
526 a fork of Microsoft's reference source code that has been altered
527 to be suitable for use with the Mono runtime.
529 This section describes how to use it.
531 An initial clone should be done recursively so all submodules will also be
532 cloned in a single pass:
534 $ git clone --recursive git@github.com:mono/mono
536 Once cloned, submodules can be updated to pull down the latest changes.
537 This can also be done after an initial non-recursive clone:
539 $ git submodule update --init --recursive
541 To pull external changes into a submodule:
544 $ git pull origin <branch>
546 $ git add <submodule>
549 By default, submodules are detached because they point to a specific commit.
550 Use `git checkout` to move back to a branch before making changes:
553 $ git checkout <branch>
554 # work as normal; the submodule is a normal repo
555 $ git commit/push new changes to the repo (submodule)
558 $ git add <submodule> # this will record the new commits to the submodule
561 To switch the repo of a submodule (this should not be a common or normal thing
562 to do at all), first edit `.gitmodules` to point to the new location, then:
564 $ git submodule sync -- <path of the submodule>
565 $ git submodule update --recursive
566 $ git checkout <desired new hash or branch>
568 The desired output diff is a change in `.gitmodules` to reflect the
569 change in the remote URL, and a change in /<submodule> where you see
570 the desired change in the commit hash.
575 See the LICENSE file for licensing information, and the PATENTS.TXT
576 file for information about Microsoft's patent grant.
578 Mono Trademark Use Policy
579 =========================
581 The use of trademarks and logos for Mono can be found [here](https://www.dotnetfoundation.org/legal/mono-tm).
583 Maintaining the Class Library Solution Files
584 ============================================
586 Mono now ships with a solution file that can be used to build the
587 assemblies from an IDE. Either by opening the topmost `net_4_x.sln`
588 file, or to by loading one of the individual `csproj` files located in
591 These are maintained by extracting the configuration information from
592 our Makefiles, which as of May 2016 remain the canonical location for
593 configuration information.
595 When changes are made to the Makefiles, a user would need to run the
596 following command to re-generate the solution files at the top level:
598 $ make update-solution-files