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