[Loader] Change mono_trace level from info to debug (#19110)
[mono-project.git] / README.md
blobbc195a5a8b8f861ee4c982dfb62b876900559ddd
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)
18 ### Build Status
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 6.1      | ppc64 (cs)         | [![aix-ppc64][23]][24]       |
34 | FreeBSD 12   | amd64 (cs)         | [![freebsd-amd64][25]][26]   |
36 _(cs) = community supported architecture_
38 [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64/badge/icon
39 [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64
40 [3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/badge/icon
41 [4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/
42 [5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/badge/icon
43 [6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/
44 [7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/badge/icon
45 [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/
46 [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/badge/icon
47 [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/
48 [11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
49 [12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
50 [13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
51 [14]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/
52 [15]: https://jenkins.mono-project.com/job/z/label=w64/badge/icon
53 [16]: https://jenkins.mono-project.com/job/z/label=w64/
54 [17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon
55 [18]: https://jenkins.mono-project.com/job/z/label=w32/
56 [19]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x/badge/icon
57 [20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x
58 [21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el/badge/icon
59 [22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el
60 [23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon
61 [24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64
62 [25]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=freebsd-12-amd64/badge/icon
63 [26]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=freebsd-12-amd64
65 Compilation and Installation
66 ============================
68 Building the Software
69 ---------------------
71 Please see our guides for building Mono on
72 [Mac OS X](https://www.mono-project.com/docs/compiling-mono/mac/),
73 [Linux](https://www.mono-project.com/docs/compiling-mono/linux/) and 
74 [Windows](https://www.mono-project.com/docs/compiling-mono/windows/).
76 Note that building from Git assumes that you already have Mono installed,
77 so please download and [install the latest Mono release](https://www.mono-project.com/download/)
78 before trying to build from Git. This is required because the Mono build
79 relies on a working Mono C# compiler to compile itself
80 (also known as [bootstrapping](https://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
82 If you don't have a working Mono installation
83 ---------------------------------------------
85 If you don't have a working Mono installation, you can try a slightly
86 more risky approach: getting the latest version of the 'monolite' distribution,
87 which contains just enough to run the 'mcs' compiler. You do this with:
89     # Run the following line after ./autogen.sh
90     make get-monolite-latest
92 This will download and place the files appropriately so that you can then
93 just run:
95     make
97 The build will then use the files downloaded by `make get-monolite-latest`.
99 Testing and Installation
100 ------------------------
102 You can run the mono and mcs test suites with the command: `make check`.
104 Expect to find a few test suite failures. As a sanity check, you
105 can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
107 You can now install mono with: `make install`
109 You can verify your installation by using the mono-test-install
110 script, it can diagnose some common problems with Mono's install.
111 Failure to follow these steps may result in a broken installation. 
113 Using Mono
114 ==========
116 Once you have installed the software, you can run a few programs:
118 * `mono program.exe` runtime engine
120 * `mcs program.cs` C# compiler
122 * `monodis program.exe` CIL Disassembler
124 See the man pages for mono(1), mcs(1) and monodis(1) for further details.
126 Directory Roadmap
127 =================
129 * `acceptance-tests/` - Optional third party test suites used to validate Mono against a wider range of test cases.
131 * `data/` - Configuration files installed as part of the Mono runtime.
133 * `docs/` - Technical documents about the Mono runtime.
135 * `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
137 * `ikvm-native/` - Glue code for ikvm.
139 * `libgc/` - The (deprecated) Boehm GC implementation.
141 * `llvm/` - Utility Makefiles for integrating the Mono LLVM fork.
143 * `m4/` - General utility Makefiles.
145 * `man/` - Manual pages for the various Mono commands and programs.
147 * `mcs/` - The class libraries, compiler and tools
149   * `class/` - The class libraries (like System.*, Microsoft.Build, etc.)
151   * `mcs/` - The Mono C# compiler written in C#
153   * `tools/` - Tools like gacutil, ikdasm, mdoc, etc.
155 * `mono/` - The core of the Mono Runtime.
157   * `arch/` - Architecture specific portions.
159   * `benchmark/` - A collection of benchmarks.
161   * `btls/` - Build files for the BTLS library which incorporates BoringSSL.
163   * `cil/` - Common Intermediate Representation, XML
164 definition of the CIL bytecodes.
166   * `dis/` - CIL executable Disassembler.
168   * `eglib/` - Independent implementation of the glib API.
170   * `metadata/` - The object system and metadata reader.
172   * `mini/` - The Just in Time Compiler.
174   * `profiler/` - The profiler implementation.
176   * `sgen/` - The SGen Garbage Collector implementation.
178   * `tests/` - The main runtime tests.
180   * `unit-tests/` - Additional runtime unit tests.
182   * `utils/` - Utility functions used across the runtime codebase.
184 * `msvc/` - Logic for the MSVC / Visual Studio based runtime and BCL build system.
185 The latter is experimental at the moment.
187 * `packaging/` - Packaging logic for the OS X and Windows Mono packages.
189 * `po/` - Translation files.
191 * `runtime/` - A directory that contains the Makefiles that link the
192 mono/ and mcs/ build systems.
194 * `samples/` - Some simple sample programs on uses of the Mono
195 runtime as an embedded library.
197 * `scripts/` - Scripts used to invoke Mono and the corresponding program.
199 * `sdks/` - A new way of embedding Mono into Xamarin.iOS, Xamarin.Android and other products.
201 * `support/` - Various support libraries.
203 * `tools/` - A collection of tools, mostly used during Mono development.
205 Contributing to Mono
206 ====================
208 Before submitting changes to Mono, please review the [contribution
209 guidelines](https://www.mono-project.com/community/contributing/).
210 Please pay particular attention to the [Important
211 Rules](https://www.mono-project.com/community/contributing/#important-rules)
212 section.
214 Reporting bugs
215 ==============
217 To submit bug reports, please [open an issue on the mono GitHub repo](https://github.com/mono/mono/issues/new).
219 Please use the search facility to ensure the same bug hasn't already
220 been submitted and follow our
221 [guidelines](https://www.mono-project.com/community/bugs/make-a-good-bug-report/)
222 on how to make a good bug report.
224 Configuration Options
225 =====================
227 The following are the configuration options that someone building Mono
228 might want to use:
230 * `--with-sgen=yes,no` - Generational GC support: Used to enable or
231 disable the compilation of a Mono runtime with the SGen garbage
232 collector.
234   * On platforms that support it, after building Mono, you will have
235 both a `mono-boehm` binary and a `mono-sgen` binary. `mono-boehm` uses Boehm,
236 while `mono-sgen` uses the Simple Generational GC.
238 * `--with-libgc=[included, none]` - Selects the default Boehm
239 garbage collector engine to use.
241   * *included*: (*slightly modified Boehm GC*) This is the default
242 value for the Boehm GC, and it's the most feature complete, it will
243 allow Mono to use typed allocations and support the debugger.
245   * *none*:
246 Disables the inclusion of a Boehm garbage collector.
248   * This defaults to `included`.
250 * `--enable-cooperative-suspend`
252   * If you pass this flag the Mono runtime is configured to only use
253   the cooperative mode of the garbage collector.  If you do not pass
254   this flag, then you can control at runtime the use of the
255   cooperative GC mode by setting the `MONO_ENABLE_COOP_SUSPEND` flag.
256   
257 * `--with-tls=__thread,pthread`
259   * Controls how Mono should access thread local storage,
260 pthread forces Mono to use the pthread APIs, while
261 __thread uses compiler-optimized access to it.
263   * Although __thread is faster, it requires support from
264 the compiler, kernel and libc. Old Linux systems do
265 not support with __thread.
267   * This value is typically pre-configured and there is no
268 need to set it, unless you are trying to debug a problem.
270 * `--with-sigaltstack=yes,no`
272   * **Experimental**: Use at your own risk, it is known to
273 cause problems with garbage collection and is hard to
274 reproduce those bugs.
276   * This controls whether Mono will install a special
277 signal handler to handle stack overflows. If set to
278 `yes`, it will turn stack overflows into the
279 StackOverflowException. Otherwise when a stack
280 overflow happens, your program will receive a
281 segmentation fault.
283   * The configure script will try to detect if your
284 operating system supports this. Some older Linux
285 systems do not support this feature, or you might want
286 to override the auto-detection.
288 * `--with-static_mono=yes,no`
290   * This controls whether `mono` should link against a
291 static library (libmono.a) or a shared library
292 (libmono.so). 
294   * This defaults to `yes`, and will improve the performance
295 of the `mono` program. 
297   * This only affects the `mono' binary, the shared
298 library libmono.so will always be produced for
299 developers that want to embed the runtime in their
300 application.
302 * `--with-xen-opt=yes,no` - Optimize code for Xen virtualization.
304   * It makes Mono generate code which might be slightly
305 slower on average systems, but the resulting executable will run
306 faster under the Xen virtualization system.
308   * This defaults to `yes`.
310 * `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
312   * This only applies only to the Boehm garbage collector, the SGen garbage
313 collector does not use this configuration option.
315   * This defaults to `no`.
317 * `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
318 and disk footprint at the expense of some capabilities.
320   * Typically this means that the number of threads that can be created
321 is limited (256), that the maximum heap size is also reduced (256 MB)
322 and other such limitations that still make mono useful, but more suitable
323 to embedded devices (like mobile phones).
325   * This defaults to `no`.
327 * `--with-ikvm-native=yes,no` - Controls whether the IKVM JNI interface library is
328 built or not.
330   * This is used if you are planning on
331 using the IKVM Java Virtual machine with Mono.
333   * This defaults to `yes`.
335 * `--with-profile4=yes,no` - Whether you want to build the 4.x profile libraries
336 and runtime.
338   * This defaults to `yes`.
340 * `--with-libgdiplus=installed,sibling,<path>` - Configure where Mono
341 searches for libgdiplus when running System.Drawing tests.
343   * It defaults to `installed`, which means that the
344 library is available to Mono through the regular
345 system setup.
347   * `sibling` can be used to specify that a libgdiplus
348 that resides as a sibling of this directory (mono)
349 should be used.
351  * Or you can specify a path to a libgdiplus.
353 * `--enable-minimal=LIST`
355   * Use this feature to specify optional runtime
356 components that you might not want to include.  This
357 is only useful for developers embedding Mono that
358 require a subset of Mono functionality.
359   * The list is a comma-separated list of components that
360 should be removed, these are:
362     * `aot`:
363 Disables support for the Ahead of Time compilation.
365     * `attach`:
366 Support for the Mono.Management assembly and the
367 VMAttach API (allowing code to be injected into
368 a target VM)
370     * `com`:
371 Disables COM support.
373     * `debug`:
374 Drop debugging support.
376     * `decimal`:
377 Disables support for System.Decimal.
379     * `full_messages`:
380 By default Mono comes with a full table
381 of messages for error codes. This feature
382 turns off uncommon error messages and reduces
383 the runtime size.
385     * `generics`:
386 Generics support.  Disabling this will not
387 allow Mono to run any 2.0 libraries or
388 code that contains generics.
390     * `jit`:
391 Removes the JIT engine from the build, this reduces
392 the executable size, and requires that all code
393 executed by the virtual machine be compiled with
394 Full AOT before execution.
396     * `large_code`:
397 Disables support for large assemblies.
399     * `logging`:
400 Disables support for debug logging.
402     * `pinvoke`:
403 Support for Platform Invocation services,
404 disabling this will drop support for any
405 libraries using DllImport.
407     * `portability`:
408 Removes support for MONO_IOMAP, the environment
409 variables for simplifying porting applications that 
410 are case-insensitive and that mix the Unix and Windows path separators.
412     * `profiler`:
413 Disables support for the default profiler.
415     * `reflection_emit`:
416 Drop System.Reflection.Emit support
418     * `reflection_emit_save`:
419 Drop support for saving dynamically created
420 assemblies (AssemblyBuilderAccess.Save) in
421 System.Reflection.Emit.
423     * `shadow_copy`:
424 Disables support for AppDomain's shadow copies
425 (you can disable this if you do not plan on 
426 using appdomains).
428     * `simd`:
429 Disables support for the Mono.SIMD intrinsics
430 library.
432     * `ssa`:
433 Disables compilation for the SSA optimization
434 framework, and the various SSA-based optimizations.
436 * `--enable-llvm`
438   * This enables the use of LLVM as a code generation engine
439 for Mono.  The LLVM code generator and optimizer will be 
440 used instead of Mono's built-in code generator for both
441 Just in Time and Ahead of Time compilations.
443   * See https://www.mono-project.com/docs/advanced/mono-llvm/ for the 
444 full details and up-to-date information on this feature.
446   * You will need to have an LLVM built that Mono can link
447 against.
449 * `--enable-big-arrays` - Enable use of arrays with indexes larger
450 than Int32.MaxValue.
452   * By default Mono has the same limitation as .NET on
453 Win32 and Win64 and limits array indexes to 32-bit
454 values (even on 64-bit systems).
456   * In certain scenarios where large arrays are required,
457 you can pass this flag and Mono will be built to
458 support 64-bit arrays.
460   * This is not the default as it breaks the C embedding
461 ABI that we have exposed through the Mono development
462 cycle.
464 * `--enable-parallel-mark`
466   * Use this option to enable the garbage collector to use
467 multiple CPUs to do its work.  This helps performance
468 on multi-CPU machines as the work is divided across CPUS.
470   * This option is not currently the default on OSX
471 as it runs into issues there.
473   * This option only applies to the Boehm GC.
475 * `--enable-dtrace`
477   * On Solaris and MacOS X builds a version of the Mono
478 runtime that contains DTrace probes and can
479 participate in the system profiling using DTrace.
481 * `--disable-dev-random`
483   * Mono uses /dev/random to obtain good random data for
484 any source that requires random numbers.   If your
485 system does not support this, you might want to
486 disable it.
488   * There are a number of runtime options to control this
489 also, see the man page.
491 * `--with-csc=roslyn,mcs,default`
493   * Use this option to configure which C# compiler to use.  By default
494     the configure script will pick Roslyn, except on platforms where
495     Roslyn does not work (Big Endian systems) where it will pick mcs.
497     If you specify "mcs", then Mono's C# compiler will be used.  This
498     also allows for a complete bootstrap of Mono's core compiler and
499     core libraries from source.
501     If you specify "roslyn", then Roslyn's C# compiler will be used.
502     This currently uses Roslyn binaries.
503   
504 * `--enable-nacl`
506   * This configures the Mono compiler to generate code
507 suitable to be used by Google's Native Client:
508 https://code.google.com/p/nativeclient/
510   * Currently this is used with Mono's AOT engine as
511 Native Client does not support JIT engines yet.
513 * `--enable-wasm`
515   * Use this option to configure mono to run on WebAssembly. It will
516     set both host and target to the WebAssembly triplet. This overrides
517     the values passed to `--host` or `--target` and ignored what config.sub guesses.
519     This is a workaround to enable usage of old automake versions that don't
520     recognize the wasm triplet.
523 Working With Submodules
524 =======================
526 Mono references several external git submodules, for example
527 a fork of Microsoft's reference source code that has been altered
528 to be suitable for use with the Mono runtime.
530 This section describes how to use it.
532 An initial clone should be done recursively so all submodules will also be
533 cloned in a single pass:
535         $ git clone --recursive git@github.com:mono/mono
537 Once cloned, submodules can be updated to pull down the latest changes.
538 This can also be done after an initial non-recursive clone:
540         $ git submodule update --init --recursive
542 To pull external changes into a submodule:
544         $ cd <submodule>
545         $ git pull origin <branch>
546         $ cd <top-level>
547         $ git add <submodule>
548         $ git commit
550 By default, submodules are detached because they point to a specific commit.
551 Use `git checkout` to move back to a branch before making changes:
553         $ cd <submodule>
554         $ git checkout <branch>
555         # work as normal; the submodule is a normal repo
556         $ git commit/push new changes to the repo (submodule)
558         $ cd <top-level>
559         $ git add <submodule> # this will record the new commits to the submodule
560         $ git commit
562 To switch the repo of a submodule (this should not be a common or normal thing
563 to do at all), first edit `.gitmodules` to point to the new location, then:
565         $ git submodule sync -- <path of the submodule>
566         $ git submodule update --recursive
567         $ git checkout <desired new hash or branch>
569 The desired output diff is a change in `.gitmodules` to reflect the
570 change in the remote URL, and a change in /<submodule> where you see
571 the desired change in the commit hash.
573 License
574 =======
576 See the LICENSE file for licensing information, and the PATENTS.TXT
577 file for information about Microsoft's patent grant.
579 Mono Trademark Use Policy
580 =========================
582 The use of trademarks and logos for Mono can be found [here](https://www.dotnetfoundation.org/legal/mono-tm). 
584 Maintaining the Class Library Solution Files
585 ============================================
587 Mono now ships with a solution file that can be used to build the
588 assemblies from an IDE.  Either by opening the topmost `net_4_x.sln`
589 file, or to by loading one of the individual `csproj` files located in
590 each directory.
592 These are maintained by extracting the configuration information from
593 our Makefiles, which as of May 2016 remain the canonical location for
594 configuration information.
596 When changes are made to the Makefiles, a user would need to run the
597 following command to re-generate the solution files at the top level:
599         $ make update-solution-files