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