mono_breakpoint_clean_code always returns TRUE. (#16603)
[mono-project.git] / README.md
blobdfa5f847656202b091aee3887636a503cadbac46
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 Join us on [Discord](https://aka.ms/dotnet-discord) in the `#monovm` channel:
10 <a href="https://aka.ms/dotnet-discord">
11   <img src="https://img.shields.io/discord/732297728826277939?style=flat-square&label=Discord&logo=discord&logoColor=white&color=7289DA">
12 </a>
14 ### Contents
16 1. [Compilation and Installation](#compilation-and-installation)
17 2. [Using Mono](#using-mono)
18 3. [Directory Roadmap](#directory-roadmap)
19 4. [Contributing to Mono](#contributing-to-mono)
20 5. [Reporting bugs](#reporting-bugs)
21 6. [Configuration Options](#configuration-options)
22 7. [Working with Submodules](#working-with-submodules)
24 ### Build Status
26 Public CI: [![Azure Pipelines](https://dev.azure.com/dnceng/public/_apis/build/status/mono/mono-ci?branchName=main)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=952&branchName=main)
28 Legacy Jenkins CI (no longer available publicly):
30 | OS           | Architecture       | Status                       |
31 |--------------|--------------------|------------------------------|
32 | Debian 9     | amd64              | [![debian-9-amd64][1]][2]    |
33 | Debian 9     | i386               | [![debian-9-i386][3]][4]     |
34 | Debian 9     | armel              | [![debian-9-armel][5]][6]    |
35 | Debian 9     | armhf              | [![debian-9-armhf][7]][8]    |
36 | Debian 9     | arm64              | [![debian-9-arm64][9]][10]   |
37 | OS X         | amd64              | [![osx-amd64][11]][12]       |
38 | OS X         | i386               | [![osx-i386][13]][14]        |
39 | Windows      | amd64              | [![windows-amd64][15]][16]   |
40 | Windows      | i386               | [![windows-i386][17]][18]    |
41 | CentOS       | s390x (cs)         | [![centos-s390x][19]][20]    |
42 | Debian 9     | ppc64el (cs)       | [![debian-9-ppc64el][21]][22]|
43 | AIX 6.1      | ppc64 (cs)         | [![aix-ppc64][23]][24]       |
44 | FreeBSD 12   | amd64 (cs)         | [![freebsd-amd64][25]][26]   |
46 _(cs) = community supported architecture_
48 [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64/badge/icon
49 [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64
50 [3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/badge/icon
51 [4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/
52 [5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/badge/icon
53 [6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/
54 [7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/badge/icon
55 [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/
56 [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/badge/icon
57 [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/
58 [11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
59 [12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
60 [13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
61 [14]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/
62 [15]: https://jenkins.mono-project.com/job/z/label=w64/badge/icon
63 [16]: https://jenkins.mono-project.com/job/z/label=w64/
64 [17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon
65 [18]: https://jenkins.mono-project.com/job/z/label=w32/
66 [19]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x/badge/icon
67 [20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x
68 [21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el/badge/icon
69 [22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el
70 [23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon
71 [24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64
72 [25]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=freebsd-12-amd64/badge/icon
73 [26]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=freebsd-12-amd64
75 Compilation and Installation
76 ============================
78 Building the Software
79 ---------------------
81 Please see our guides for building Mono on
82 [Mac OS X](https://www.mono-project.com/docs/compiling-mono/mac/),
83 [Linux](https://www.mono-project.com/docs/compiling-mono/linux/) and 
84 [Windows](https://www.mono-project.com/docs/compiling-mono/windows/).
86 Note that building from Git assumes that you already have Mono installed,
87 so please download and [install the latest Mono release](https://www.mono-project.com/download/)
88 before trying to build from Git. This is required because the Mono build
89 relies on a working Mono C# compiler to compile itself
90 (also known as [bootstrapping](https://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
92 If you don't have a working Mono installation
93 ---------------------------------------------
95 If you don't have a working Mono installation, you can try a slightly
96 more risky approach: getting the latest version of the 'monolite' distribution,
97 which contains just enough to run the 'mcs' compiler. You do this with:
99     # Run the following line after ./autogen.sh
100     make get-monolite-latest
102 This will download and place the files appropriately so that you can then
103 just run:
105     make
107 The build will then use the files downloaded by `make get-monolite-latest`.
109 Testing and Installation
110 ------------------------
112 You can run the mono and mcs test suites with the command: `make check`.
114 Expect to find a few test suite failures. As a sanity check, you
115 can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
117 You can now install mono with: `make install`
119 You can verify your installation by using the mono-test-install
120 script, it can diagnose some common problems with Mono's install.
121 Failure to follow these steps may result in a broken installation. 
123 Using Mono
124 ==========
126 Once you have installed the software, you can run a few programs:
128 * `mono program.exe` runtime engine
130 * `mcs program.cs` C# compiler
132 * `monodis program.exe` CIL Disassembler
134 See the man pages for mono(1), mcs(1) and monodis(1) for further details.
136 Directory Roadmap
137 =================
139 * `acceptance-tests/` - Optional third party test suites used to validate Mono against a wider range of test cases.
141 * `data/` - Configuration files installed as part of the Mono runtime.
143 * `docs/` - Technical documents about the Mono runtime.
145 * `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
147 * `ikvm-native/` - Glue code for ikvm.
149 * `libgc/` - The (deprecated) Boehm GC implementation.
151 * `llvm/` - Utility Makefiles for integrating the Mono LLVM fork.
153 * `m4/` - General utility Makefiles.
155 * `man/` - Manual pages for the various Mono commands and programs.
157 * `mcs/` - The class libraries, compiler and tools
159   * `class/` - The class libraries (like System.*, Microsoft.Build, etc.)
161   * `mcs/` - The Mono C# compiler written in C#
163   * `tools/` - Tools like gacutil, ikdasm, mdoc, etc.
165 * `mono/` - The core of the Mono Runtime.
167   * `arch/` - Architecture specific portions.
169   * `benchmark/` - A collection of benchmarks.
171   * `btls/` - Build files for the BTLS library which incorporates BoringSSL.
173   * `cil/` - Common Intermediate Representation, XML
174 definition of the CIL bytecodes.
176   * `dis/` - CIL executable Disassembler.
178   * `eglib/` - Independent implementation of the glib API.
180   * `metadata/` - The object system and metadata reader.
182   * `mini/` - The Just in Time Compiler.
184   * `profiler/` - The profiler implementation.
186   * `sgen/` - The SGen Garbage Collector implementation.
188   * `tests/` - The main runtime tests.
190   * `unit-tests/` - Additional runtime unit tests.
192   * `utils/` - Utility functions used across the runtime codebase.
194 * `msvc/` - Logic for the MSVC / Visual Studio based runtime and BCL build system.
195 The latter is experimental at the moment.
197 * `packaging/` - Packaging logic for the OS X and Windows Mono packages.
199 * `po/` - Translation files.
201 * `runtime/` - A directory that contains the Makefiles that link the
202 mono/ and mcs/ build systems.
204 * `samples/` - Some simple sample programs on uses of the Mono
205 runtime as an embedded library.
207 * `scripts/` - Scripts used to invoke Mono and the corresponding program.
209 * `sdks/` - A new way of embedding Mono into Xamarin.iOS, Xamarin.Android and other products.
211 * `support/` - Various support libraries.
213 * `tools/` - A collection of tools, mostly used during Mono development.
215 Contributing to Mono
216 ====================
218 Before submitting changes to Mono, please review the [contribution
219 guidelines](https://www.mono-project.com/community/contributing/).
220 Please pay particular attention to the [Important
221 Rules](https://www.mono-project.com/community/contributing/#important-rules)
222 section.
224 Reporting bugs
225 ==============
227 To submit bug reports, please [open an issue on the mono GitHub repo](https://github.com/mono/mono/issues/new).
229 Please use the search facility to ensure the same bug hasn't already
230 been submitted and follow our
231 [guidelines](https://www.mono-project.com/community/bugs/make-a-good-bug-report/)
232 on how to make a good bug report.
234 Configuration Options
235 =====================
237 The following are the configuration options that someone building Mono
238 might want to use:
240 * `--with-sgen=yes,no` - Generational GC support: Used to enable or
241 disable the compilation of a Mono runtime with the SGen garbage
242 collector.
244   * On platforms that support it, after building Mono, you will have
245 both a `mono-boehm` binary and a `mono-sgen` binary. `mono-boehm` uses Boehm,
246 while `mono-sgen` uses the Simple Generational GC.
248 * `--with-libgc=[included, none]` - Selects the default Boehm
249 garbage collector engine to use.
251   * *included*: (*slightly modified Boehm GC*) This is the default
252 value for the Boehm GC, and it's the most feature complete, it will
253 allow Mono to use typed allocations and support the debugger.
255   * *none*:
256 Disables the inclusion of a Boehm garbage collector.
258   * This defaults to `included`.
260 * `--enable-cooperative-suspend`
262   * If you pass this flag the Mono runtime is configured to only use
263   the cooperative mode of the garbage collector.  If you do not pass
264   this flag, then you can control at runtime the use of the
265   cooperative GC mode by setting the `MONO_ENABLE_COOP_SUSPEND` flag.
266   
267 * `--with-tls=__thread,pthread`
269   * Controls how Mono should access thread local storage,
270 pthread forces Mono to use the pthread APIs, while
271 __thread uses compiler-optimized access to it.
273   * Although __thread is faster, it requires support from
274 the compiler, kernel and libc. Old Linux systems do
275 not support with __thread.
277   * This value is typically pre-configured and there is no
278 need to set it, unless you are trying to debug a problem.
280 * `--with-sigaltstack=yes,no`
282   * **Experimental**: Use at your own risk, it is known to
283 cause problems with garbage collection and is hard to
284 reproduce those bugs.
286   * This controls whether Mono will install a special
287 signal handler to handle stack overflows. If set to
288 `yes`, it will turn stack overflows into the
289 StackOverflowException. Otherwise when a stack
290 overflow happens, your program will receive a
291 segmentation fault.
293   * The configure script will try to detect if your
294 operating system supports this. Some older Linux
295 systems do not support this feature, or you might want
296 to override the auto-detection.
298 * `--with-static_mono=yes,no`
300   * This controls whether `mono` should link against a
301 static library (libmono.a) or a shared library
302 (libmono.so). 
304   * This defaults to `yes`, and will improve the performance
305 of the `mono` program. 
307   * This only affects the `mono' binary, the shared
308 library libmono.so will always be produced for
309 developers that want to embed the runtime in their
310 application.
312 * `--with-xen-opt=yes,no` - Optimize code for Xen virtualization.
314   * It makes Mono generate code which might be slightly
315 slower on average systems, but the resulting executable will run
316 faster under the Xen virtualization system.
318   * This defaults to `yes`.
320 * `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
322   * This only applies only to the Boehm garbage collector, the SGen garbage
323 collector does not use this configuration option.
325   * This defaults to `no`.
327 * `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
328 and disk footprint at the expense of some capabilities.
330   * Typically this means that the number of threads that can be created
331 is limited (256), that the maximum heap size is also reduced (256 MB)
332 and other such limitations that still make mono useful, but more suitable
333 to embedded devices (like mobile phones).
335   * This defaults to `no`.
337 * `--with-ikvm-native=yes,no` - Controls whether the IKVM JNI interface library is
338 built or not.
340   * This is used if you are planning on
341 using the IKVM Java Virtual machine with Mono.
343   * This defaults to `yes`.
345 * `--with-profile4=yes,no` - Whether you want to build the 4.x profile libraries
346 and runtime.
348   * This defaults to `yes`.
350 * `--with-libgdiplus=installed,sibling,<path>` - Configure where Mono
351 searches for libgdiplus when running System.Drawing tests.
353   * It defaults to `installed`, which means that the
354 library is available to Mono through the regular
355 system setup.
357   * `sibling` can be used to specify that a libgdiplus
358 that resides as a sibling of this directory (mono)
359 should be used.
361  * Or you can specify a path to a libgdiplus.
363 * `--enable-minimal=LIST`
365   * Use this feature to specify optional runtime
366 components that you might not want to include.  This
367 is only useful for developers embedding Mono that
368 require a subset of Mono functionality.
369   * The list is a comma-separated list of components that
370 should be removed, these are:
372     * `aot`:
373 Disables support for the Ahead of Time compilation.
375     * `attach`:
376 Support for the Mono.Management assembly and the
377 VMAttach API (allowing code to be injected into
378 a target VM)
380     * `com`:
381 Disables COM support.
383     * `debug`:
384 Drop debugging support.
386     * `decimal`:
387 Disables support for System.Decimal.
389     * `full_messages`:
390 By default Mono comes with a full table
391 of messages for error codes. This feature
392 turns off uncommon error messages and reduces
393 the runtime size.
395     * `generics`:
396 Generics support.  Disabling this will not
397 allow Mono to run any 2.0 libraries or
398 code that contains generics.
400     * `jit`:
401 Removes the JIT engine from the build, this reduces
402 the executable size, and requires that all code
403 executed by the virtual machine be compiled with
404 Full AOT before execution.
406     * `large_code`:
407 Disables support for large assemblies.
409     * `logging`:
410 Disables support for debug logging.
412     * `pinvoke`:
413 Support for Platform Invocation services,
414 disabling this will drop support for any
415 libraries using DllImport.
417     * `portability`:
418 Removes support for MONO_IOMAP, the environment
419 variables for simplifying porting applications that 
420 are case-insensitive and that mix the Unix and Windows path separators.
422     * `profiler`:
423 Disables support for the default profiler.
425     * `reflection_emit`:
426 Drop System.Reflection.Emit support
428     * `reflection_emit_save`:
429 Drop support for saving dynamically created
430 assemblies (AssemblyBuilderAccess.Save) in
431 System.Reflection.Emit.
433     * `shadow_copy`:
434 Disables support for AppDomain's shadow copies
435 (you can disable this if you do not plan on 
436 using appdomains).
438     * `simd`:
439 Disables support for the Mono.SIMD intrinsics
440 library.
442     * `ssa`:
443 Disables compilation for the SSA optimization
444 framework, and the various SSA-based optimizations.
446 * `--enable-llvm`
448   * This enables the use of LLVM as a code generation engine
449 for Mono.  The LLVM code generator and optimizer will be 
450 used instead of Mono's built-in code generator for both
451 Just in Time and Ahead of Time compilations.
453   * See https://www.mono-project.com/docs/advanced/mono-llvm/ for the 
454 full details and up-to-date information on this feature.
456   * You will need to have an LLVM built that Mono can link
457 against.
459 * `--enable-big-arrays` - Enable use of arrays with indexes larger
460 than Int32.MaxValue.
462   * By default Mono has the same limitation as .NET on
463 Win32 and Win64 and limits array indexes to 32-bit
464 values (even on 64-bit systems).
466   * In certain scenarios where large arrays are required,
467 you can pass this flag and Mono will be built to
468 support 64-bit arrays.
470   * This is not the default as it breaks the C embedding
471 ABI that we have exposed through the Mono development
472 cycle.
474 * `--enable-parallel-mark`
476   * Use this option to enable the garbage collector to use
477 multiple CPUs to do its work.  This helps performance
478 on multi-CPU machines as the work is divided across CPUS.
480   * This option is not currently the default on OSX
481 as it runs into issues there.
483   * This option only applies to the Boehm GC.
485 * `--enable-dtrace`
487   * On Solaris and MacOS X builds a version of the Mono
488 runtime that contains DTrace probes and can
489 participate in the system profiling using DTrace.
491 * `--disable-dev-random`
493   * Mono uses /dev/random to obtain good random data for
494 any source that requires random numbers.   If your
495 system does not support this, you might want to
496 disable it.
498   * There are a number of runtime options to control this
499 also, see the man page.
501 * `--with-csc=roslyn,mcs,default`
503   * Use this option to configure which C# compiler to use.  By default
504     the configure script will pick Roslyn, except on platforms where
505     Roslyn does not work (Big Endian systems) where it will pick mcs.
507     If you specify "mcs", then Mono's C# compiler will be used.  This
508     also allows for a complete bootstrap of Mono's core compiler and
509     core libraries from source.
511     If you specify "roslyn", then Roslyn's C# compiler will be used.
512     This currently uses Roslyn binaries.
513   
514 * `--enable-nacl`
516   * This configures the Mono compiler to generate code
517 suitable to be used by Google's Native Client:
518 https://code.google.com/p/nativeclient/
520   * Currently this is used with Mono's AOT engine as
521 Native Client does not support JIT engines yet.
523 * `--enable-wasm`
525   * Use this option to configure mono to run on WebAssembly. It will
526     set both host and target to the WebAssembly triplet. This overrides
527     the values passed to `--host` or `--target` and ignored what config.sub guesses.
529     This is a workaround to enable usage of old automake versions that don't
530     recognize the wasm triplet.
533 Working With Submodules
534 =======================
536 Mono references several external git submodules, for example
537 a fork of Microsoft's reference source code that has been altered
538 to be suitable for use with the Mono runtime.
540 This section describes how to use it.
542 An initial clone should be done recursively so all submodules will also be
543 cloned in a single pass:
545         $ git clone --recursive git@github.com:mono/mono
547 Once cloned, submodules can be updated to pull down the latest changes.
548 This can also be done after an initial non-recursive clone:
550         $ git submodule update --init --recursive
552 To pull external changes into a submodule:
554         $ cd <submodule>
555         $ git pull origin <branch>
556         $ cd <top-level>
557         $ git add <submodule>
558         $ git commit
560 By default, submodules are detached because they point to a specific commit.
561 Use `git checkout` to move back to a branch before making changes:
563         $ cd <submodule>
564         $ git checkout <branch>
565         # work as normal; the submodule is a normal repo
566         $ git commit/push new changes to the repo (submodule)
568         $ cd <top-level>
569         $ git add <submodule> # this will record the new commits to the submodule
570         $ git commit
572 To switch the repo of a submodule (this should not be a common or normal thing
573 to do at all), first edit `.gitmodules` to point to the new location, then:
575         $ git submodule sync -- <path of the submodule>
576         $ git submodule update --recursive
577         $ git checkout <desired new hash or branch>
579 The desired output diff is a change in `.gitmodules` to reflect the
580 change in the remote URL, and a change in /<submodule> where you see
581 the desired change in the commit hash.
583 License
584 =======
586 See the LICENSE file for licensing information, and the PATENTS.TXT
587 file for information about Microsoft's patent grant.
589 Mono Trademark Use Policy
590 =========================
592 The use of trademarks and logos for Mono can be found [here](https://www.dotnetfoundation.org/legal/mono-tm).