Merge pull request #3144 from Unity-Technologies/fix-recursive-property-call
[mono.git] / README.md
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.
5
6 The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.org/)
7
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)
9
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)
17
18 **Build Status**
19
20 Officially supported architectures:
21
22 | ubuntu-1404-amd64            | ubuntu-1404-i386            | debian-8-armel            | debian-8-armhf            | debian-8-arm64              | windows-amd64              |
23 |------------------------------|-----------------------------|---------------------------|---------------------------|-----------------------------|----------------------------|
24 | [![ubuntu-1404-amd64][1]][2] | [![ubuntu-1404-i386][3]][4] | [![debian-8-armel][5]][6] | [![debian-8-armhf][7]][8] | [![debian-8-arm64][9]][10]  | [![windows-amd64][11]][12] |
25
26 Community supported architectures:
27
28 | centos-s390x              |
29 |---------------------------|
30 | [![centos-s390x][13]][14] |
31
32 [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64/badge/icon
33 [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64
34 [3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/badge/icon
35 [4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/
36 [5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/badge/icon
37 [6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/
38 [7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/badge/icon
39 [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/
40 [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/badge/icon
41 [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/
42 [11]: https://ci.appveyor.com/api/projects/status/1e61ebdfpbiei58v/branch/master?svg=true
43 [12]: https://ci.appveyor.com/project/ajlennon/mono-817/branch/master
44 [13]: https://jenkins.mono-project.com/job/z/label=centos-s390x/badge/icon
45 [14]: https://jenkins.mono-project.com/job/z/label=centos-s390x
46
47 Compilation and Installation
48 ============================
49
50 Building the Software
51 ---------------------
52
53 Please see our guides for building Mono on
54 [Mac OS X](http://www.mono-project.com/docs/compiling-mono/mac/),
55 [Linux](http://www.mono-project.com/docs/compiling-mono/linux/) and 
56 [Windows](http://www.mono-project.com/docs/compiling-mono/windows/).
57
58 Note that building from Git assumes that you already have Mono installed,
59 so please download and [install the latest Mono release](http://www.mono-project.com/download/)
60 before trying to build from Git. This is required because the Mono build
61 relies on a working Mono C# compiler to compile itself
62 (also known as [bootstrapping](http://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
63
64 If you don't have a working Mono installation
65 ---------------------------------------------
66
67 If you don't have a working Mono installation, you can try a slightly
68 more risky approach: getting the latest version of the 'monolite' distribution,
69 which contains just enough to run the 'mcs' compiler. You do this with:
70
71     # Run the following line after ./autogen.sh
72     make get-monolite-latest
73
74 This will download and place the files appropriately so that you can then
75 just run:
76
77     make
78
79 The build will then use the files downloaded by `make get-monolite-latest`.
80
81 Testing and Installation
82 ------------------------
83
84 You can run the mono and mcs test suites with the command: `make check`.
85
86 Expect to find a few test suite failures. As a sanity check, you
87 can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
88
89 You can now install mono with: `make install`
90
91 You can verify your installation by using the mono-test-install
92 script, it can diagnose some common problems with Mono's install.
93 Failure to follow these steps may result in a broken installation. 
94
95 Using Mono
96 ==========
97
98 Once you have installed the software, you can run a few programs:
99
100 * `mono program.exe` runtime engine
101
102 * `mcs program.cs` C# compiler 
103
104 * `monodis program.exe` CIL Disassembler
105
106 See the man pages for mono(1), mcs(1) and monodis(1) for further details.
107
108 Directory Roadmap
109 =================
110
111 * `acceptance-tests/` - Optional third party test suites used to validate Mono against a wider range of test cases.
112
113 * `data/` - Configuration files installed as part of the Mono runtime.
114
115 * `docs/` - Technical documents about the Mono runtime.
116
117 * `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
118
119 * `man/` - Manual pages for the various Mono commands and programs.
120
121 * `mcs/` - The class libraries, compiler and tools
122
123   * `class/` - The class libraries (like System.*, Microsoft.Build, etc.)
124
125   * `mcs/` - The Mono C# compiler written in C#
126
127   * `tools/` - Tools like gacutil, ikdasm, mdoc, etc.
128
129 * `mono/` - The core of the Mono Runtime.
130
131   * `arch/` - Architecture specific portions.
132
133   * `cil/` - Common Intermediate Representation, XML
134 definition of the CIL bytecodes.
135
136   * `dis/` - CIL executable Disassembler
137
138   * `io-layer/` - The I/O layer and system abstraction for 
139 emulating the .NET IO model.
140
141   * `metadata/` - The object system and metadata reader.
142
143   * `mini/` - The Just in Time Compiler.
144
145 * `runtime/` - A directory that contains the Makefiles that link the
146 mono/ and mcs/ build systems.
147
148 * `samples/` -Some simple sample programs on uses of the Mono
149 runtime as an embedded library.   
150
151 * `scripts/` - Scripts used to invoke Mono and the corresponding program.
152
153 Contributing to Mono
154 ====================
155
156 Before submitting changes to Mono, please review the [contribution
157 guidelines](http://www.mono-project.com/community/contributing/).
158 Please pay particular attention to the [Important
159 Rules](http://www.mono-project.com/community/contributing/#important-rules)
160 section.
161
162 Reporting bugs
163 ==============
164
165 To submit bug reports, please use [Xamarin's
166 Bugzilla](https://bugzilla.xamarin.com/)
167
168 Please use the search facility to ensure the same bug hasn't already
169 been submitted and follow our
170 [guidelines](http://www.mono-project.com/community/bugs/make-a-good-bug-report/)
171 on how to make a good bug report.
172
173 Configuration Options
174 =====================
175
176 The following are the configuration options that someone building Mono
177 might want to use:
178
179 * `--with-sgen=yes,no` - Generational GC support: Used to enable or
180 disable the compilation of a Mono runtime with the SGen garbage
181 collector.
182
183   * On platforms that support it, after building Mono, you will have
184 both a `mono` binary and a `mono-sgen` binary. `mono` uses Boehm,
185 while `mono-sgen` uses the Simple Generational GC.
186
187 * `--with-gc=[included, boehm, none]` - Selects the default Boehm
188 garbage collector engine to use.
189
190   * *included*: (*slightly modified Boehm GC*) This is the default
191 value for the Boehm GC, and it's the most feature complete, it will
192 allow Mono to use typed allocations and support the debugger.
193
194   * *boehm*: This is used to use a system-install Boehm GC, it is
195 useful to test new features available in Boehm GC, but we do not
196 recommend that people use this, as it disables a few features.
197
198   * *none*:
199 Disables the inclusion of a garbage collector.
200
201   * This defaults to `included`.
202
203 * `--with-cooperative-gc`
204
205   * If you pass this flag the Mono runtime is configured to only use
206   the cooperative mode of the garbage collector.  If you do not pass
207   this flag, then you can control at runtime the use of the
208   cooperative GC mode by setting the `MONO_ENABLE_COOP` flag.
209   
210 * `--with-tls=__thread,pthread`
211
212   * Controls how Mono should access thread local storage,
213 pthread forces Mono to use the pthread APIs, while
214 __thread uses compiler-optimized access to it.
215
216   * Although __thread is faster, it requires support from
217 the compiler, kernel and libc. Old Linux systems do
218 not support with __thread.
219
220   * This value is typically pre-configured and there is no
221 need to set it, unless you are trying to debug a problem.
222
223 * `--with-sigaltstack=yes,no`
224
225   * **Experimental**: Use at your own risk, it is known to
226 cause problems with garbage collection and is hard to
227 reproduce those bugs.
228
229   * This controls whether Mono will install a special
230 signal handler to handle stack overflows. If set to
231 `yes`, it will turn stack overflows into the
232 StackOverflowException. Otherwise when a stack
233 overflow happens, your program will receive a
234 segmentation fault.
235
236   * The configure script will try to detect if your
237 operating system supports this. Some older Linux
238 systems do not support this feature, or you might want
239 to override the auto-detection.
240
241 * `--with-static_mono=yes,no`
242
243   * This controls whether `mono` should link against a
244 static library (libmono.a) or a shared library
245 (libmono.so). 
246
247   * This defaults to `yes`, and will improve the performance
248 of the `mono` program. 
249
250   * This only affects the `mono' binary, the shared
251 library libmono.so will always be produced for
252 developers that want to embed the runtime in their
253 application.
254
255 * `--with-xen-opt=yes,no` - Optimize code for Xen virtualization.
256
257   * It makes Mono generate code which might be slightly
258 slower on average systems, but the resulting executable will run
259 faster under the Xen virtualization system.
260
261   * This defaults to `yes`.
262
263 * `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
264
265   * This defaults to `no`.
266
267 * `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
268 and disk footprint at the expense of some capabilities.
269
270   * Typically this means that the number of threads that can be created
271 is limited (256), that the maximum heap size is also reduced (256 MB)
272 and other such limitations that still make mono useful, but more suitable
273 to embedded devices (like mobile phones).
274
275   * This defaults to `no`.
276
277 * `--with-ikvm-native=yes,no` - Controls whether the IKVM JNI interface library is
278 built or not.
279
280   * This is used if you are planning on
281 using the IKVM Java Virtual machine with Mono.
282
283   * This defaults to `yes`.
284
285 * `--with-profile4=yes,no` - Whether you want to build the 4.x profile libraries
286 and runtime.
287
288   * This defaults to `yes`.
289
290 * `--with-libgdiplus=installed,sibling,<path>` - Configure where Mono
291 searches for libgdiplus when running System.Drawing tests.
292
293   * It defaults to `installed`, which means that the
294 library is available to Mono through the regular
295 system setup.
296
297   * `sibling` can be used to specify that a libgdiplus
298 that resides as a sibling of this directory (mono)
299 should be used.
300
301  * Or you can specify a path to a libgdiplus.
302
303 * `--disable-shared-memory`
304
305   * Use this option to disable the use of shared memory in
306 Mono (this is equivalent to setting the MONO_DISABLE_SHM
307 environment variable, although this removes the feature
308 completely).
309
310   * Disabling the shared memory support will disable certain
311 features like cross-process named mutexes.
312
313 * `--enable-minimal=LIST`
314
315   * Use this feature to specify optional runtime
316 components that you might not want to include.  This
317 is only useful for developers embedding Mono that
318 require a subset of Mono functionality.
319   * The list is a comma-separated list of components that
320 should be removed, these are:
321
322     * `aot`:
323 Disables support for the Ahead of Time compilation.
324
325     * `attach`:
326 Support for the Mono.Management assembly and the
327 VMAttach API (allowing code to be injected into
328 a target VM)
329
330     * `com`:
331 Disables COM support.
332
333     * `debug`:
334 Drop debugging support.
335
336     * `decimal`:
337 Disables support for System.Decimal.
338
339     * `full_messages`:
340 By default Mono comes with a full table
341 of messages for error codes. This feature
342 turns off uncommon error messages and reduces
343 the runtime size.
344
345     * `generics`:
346 Generics support.  Disabling this will not
347 allow Mono to run any 2.0 libraries or
348 code that contains generics.
349
350     * `jit`:
351 Removes the JIT engine from the build, this reduces
352 the executable size, and requires that all code
353 executed by the virtual machine be compiled with
354 Full AOT before execution.
355
356     * `large_code`:
357 Disables support for large assemblies.
358
359     * `logging`:
360 Disables support for debug logging.
361
362     * `pinvoke`:
363 Support for Platform Invocation services,
364 disabling this will drop support for any
365 libraries using DllImport.
366
367     * `portability`:
368 Removes support for MONO_IOMAP, the environment
369 variables for simplifying porting applications that 
370 are case-insensitive and that mix the Unix and Windows path separators.
371
372     * `profiler`:
373 Disables support for the default profiler.
374
375     * `reflection_emit`:
376 Drop System.Reflection.Emit support
377
378     * `reflection_emit_save`:
379 Drop support for saving dynamically created
380 assemblies (AssemblyBuilderAccess.Save) in
381 System.Reflection.Emit.
382
383     * `shadow_copy`:
384 Disables support for AppDomain's shadow copies
385 (you can disable this if you do not plan on 
386 using appdomains).
387
388     * `simd`:
389 Disables support for the Mono.SIMD intrinsics
390 library.
391
392     * `ssa`:
393 Disables compilation for the SSA optimization
394 framework, and the various SSA-based optimizations.
395
396 * `--enable-llvm`
397 * `--enable-loadedllvm`
398
399   * This enables the use of LLVM as a code generation engine
400 for Mono.  The LLVM code generator and optimizer will be 
401 used instead of Mono's built-in code generator for both
402 Just in Time and Ahead of Time compilations.
403
404   * See http://www.mono-project.com/docs/advanced/mono-llvm/ for the 
405 full details and up-to-date information on this feature.
406
407   * You will need to have an LLVM built that Mono can link
408 against.
409
410   * The `--enable-loadedllvm` variant will make the LLVM backend
411 into a runtime-loadable module instead of linking it directly
412 into the main mono binary.
413
414 * `--enable-big-arrays` - Enable use of arrays with indexes larger
415 than Int32.MaxValue.
416
417   * By default Mono has the same limitation as .NET on
418 Win32 and Win64 and limits array indexes to 32-bit
419 values (even on 64-bit systems).
420
421   * In certain scenarios where large arrays are required,
422 you can pass this flag and Mono will be built to
423 support 64-bit arrays.
424
425   * This is not the default as it breaks the C embedding
426 ABI that we have exposed through the Mono development
427 cycle.
428
429 * `--enable-parallel-mark`
430
431   * Use this option to enable the garbage collector to use
432 multiple CPUs to do its work.  This helps performance
433 on multi-CPU machines as the work is divided across CPUS.
434
435   * This option is not currently the default on OSX
436 as it runs into issues there.
437
438   * This option only applies to the Boehm GC.
439
440 * `--enable-dtrace`
441
442   * On Solaris and MacOS X builds a version of the Mono
443 runtime that contains DTrace probes and can
444 participate in the system profiling using DTrace.
445
446 * `--disable-dev-random`
447
448   * Mono uses /dev/random to obtain good random data for
449 any source that requires random numbers.   If your
450 system does not support this, you might want to
451 disable it.
452
453   * There are a number of runtime options to control this
454 also, see the man page.
455
456 * `--enable-nacl`
457
458   * This configures the Mono compiler to generate code
459 suitable to be used by Google's Native Client:
460 http://code.google.com/p/nativeclient/
461
462   * Currently this is used with Mono's AOT engine as
463 Native Client does not support JIT engines yet.
464
465 Working With Submodules
466 =======================
467
468 Mono references several external git submodules, for example
469 a fork of Microsoft's reference source code that has been altered
470 to be suitable for use with the Mono runtime.
471
472 This section describes how to use it.
473
474 An initial clone should be done recursively so all submodules will also be
475 cloned in a single pass:
476
477         $ git clone --recursive git@github.com:mono/mono
478
479 Once cloned, submodules can be updated to pull down the latest changes.
480 This can also be done after an initial non-recursive clone:
481
482         $ git submodule update --init --recursive
483
484 To pull external changes into a submodule:
485
486         $ cd <submodule>
487         $ git pull origin <branch>
488         $ cd <top-level>
489         $ git add <submodule>
490         $ git commit
491
492 By default, submodules are detached because they point to a specific commit.
493 Use `git checkout` to move back to a branch before making changes:
494
495         $ cd <submodule>
496         $ git checkout <branch>
497         # work as normal; the submodule is a normal repo
498         $ git commit/push new changes to the repo (submodule)
499
500         $ cd <top-level>
501         $ git add <submodule> # this will record the new commits to the submodule
502         $ git commit
503
504 To switch the repo of a submodule (this should not be a common or normal thing
505 to do at all), first edit `.gitmodules` to point to the new location, then:
506
507         $ git submodule sync -- <path of the submodule>
508         $ git submodule update --recursive
509         $ git checkout <desired new hash or branch>
510
511 The desired output diff is a change in `.gitmodules` to reflect the
512 change in the remote URL, and a change in /<submodule> where you see
513 the desired change in the commit hash.
514
515 License
516 =======
517
518 See the LICENSE file for licensing information, and the PATENTS.TXT
519 file for information about Microsoft's patent grant.
520
521 Mono Trademark Use Policy
522 =========================
523
524 The use of trademarks and logos for Mono can be found [here] (http://www.dotnetfoundation.org/legal/mono-tm). 
525
526 Maintaining the Class Library Solution Files
527 ============================================
528
529 Mono now ships with a solution file that can be used to build the
530 assemblies from an IDE.  Either by opening the topmost `net_4_x.sln`
531 file, or to by loading one of the individual `csproj` files located in
532 each directory.
533
534 These are maintained by extracting the configuration information from
535 our Makefiles, which as of May 2016 remain the canonical location for
536 configuration information.
537
538 When changes are made to the Makefiles, a user would need to run the
539 following command to re-generate the solution files at the top level:
540
541         $ make update-solution-files
542