README 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. This is Mono.
  2. 1. Installation
  3. 2. Using Mono
  4. 3. Directory Roadmap
  5. 1. Compilation and Installation
  6. ===============================
  7. a. Build Requirements
  8. ---------------------
  9. To build Mono, you will need the following components:
  10. * pkg-config
  11. Available from: http://www.freedesktop.org/Software/pkgconfig
  12. * glib 2.4
  13. Available from: http://www.gtk.org/
  14. On Itanium, you must obtain libunwind:
  15. http://www.hpl.hp.com/research/linux/libunwind/download.php4
  16. On Solaris, make sure that you used GNU tar to unpack this package, as
  17. Solaris tar will not unpack this correctly, and you will get strange errors.
  18. On Solaris, make sure that you use the GNU toolchain to build the software.
  19. Optional dependencies:
  20. * libgdiplus
  21. If you want to get support for System.Drawing, you will need to get
  22. Libgdiplus.
  23. * libzlib
  24. This library and the development headers are required for compression
  25. file support in the 2.0 profile.
  26. b. Building the Software
  27. ------------------------
  28. If you obtained this package as an officially released tarball,
  29. this is very simple, use configure and make:
  30. ./configure --prefix=/usr/local
  31. make
  32. make install
  33. Mono supports a JIT engine on x86, SPARC, SPARCv9, S/390,
  34. S/390x, AMD64, ARM and PowerPC systems.
  35. If you obtained this as a snapshot, you will need an existing
  36. Mono installation. To upgrade your installation, unpack both
  37. mono and mcs:
  38. tar xzf mcs-XXXX.tar.gz
  39. tar xzf mono-XXXX.tar.gz
  40. mv mono-XXX mono
  41. mv mcs-XXX mcs
  42. cd mono
  43. ./autogen.sh --prefix=/usr/local
  44. make
  45. The Mono build system is silent for most compilation commands.
  46. To enable a more verbose compile (for example, to pinpoint
  47. problems in your makefiles or your system) pass the V=1 flag to make, like this:
  48. make V=1
  49. c. Building the software from SVN
  50. ---------------------------------
  51. If you are building the software from SVN, make sure that you
  52. have up-to-date mcs and mono sources:
  53. svn co svn+ssh://[email protected]/source/trunk/mono
  54. svn co svn+ssh://[email protected]/source/trunk/mcs
  55. Then, go into the mono directory, and configure:
  56. cd mono
  57. ./autogen.sh --prefix=/usr/local
  58. make
  59. For people with non-standard installations of the auto* utils and of
  60. pkg-config (common on misconfigured OSX and windows boxes), you could get
  61. an error like this:
  62. ./configure: line 19176: syntax error near unexpected token `PKG_CHECK_MODULES(BASE_DEPENDENCIES,' ...
  63. This means that you need to set the ACLOCAL_FLAGS environment var
  64. when invoking autogen.sh, like this:
  65. ACLOCAL_FLAGS="-I $acprefix/share/aclocal" ./autogen.sh --prefix=/usr/loca
  66. where $acprefix is the prefix where aclocal has been installed.
  67. This will automatically go into the mcs/ tree and build the
  68. binaries there.
  69. This assumes that you have a working mono installation, and that
  70. there's a C# compiler named 'mcs', and a corresponding IL
  71. runtime called 'mono'. You can use two make variables
  72. EXTERNAL_MCS and EXTERNAL_RUNTIME to override these. e.g., you
  73. can say
  74. make EXTERNAL_MCS=/foo/bar/mcs EXTERNAL_RUNTIME=/somewhere/else/mono
  75. If you don't have a working Mono installation
  76. ---------------------------------------------
  77. If you don't have a working Mono installation, an obvious choice
  78. is to install the latest released packages of 'mono' for your
  79. distribution and running autogen.sh; make; make install in the
  80. mono module directory.
  81. You can also try a slightly more risky approach: this may not work,
  82. so start from the released tarball as detailed above.
  83. This works by first getting the latest version of the 'monolite'
  84. distribution, which contains just enough to run the 'mcs'
  85. compiler. You do this with:
  86. make get-monolite-latest
  87. This will download and automatically gunzip and untar the
  88. tarball, and place the files appropriately so that you can then
  89. just run:
  90. make
  91. To ensure that you're using the 'monolite' distribution, you can
  92. also try passing EXTERNAL_MCS=false on the make command-line.
  93. Testing and Installation
  94. ------------------------
  95. You can run (part of) the mono and mcs testsuites with the command:
  96. make check
  97. All tests should pass.
  98. If you want more extensive tests, including those that test the
  99. class libraries, you need to re-run 'configure' with the
  100. '--enable-nunit-tests' flag, and try
  101. make -k check
  102. Expect to find a few testsuite failures. As a sanity check, you
  103. can compare the failures you got with
  104. http://go-mono.com/tests/displayTestResults.php
  105. You can now install mono with:
  106. make install
  107. Failure to follow these steps may result in a broken installation.
  108. d. Common Configuration Options
  109. -------------------------------
  110. The following are the configuration options that someone
  111. building Mono might want to use:
  112. --with-sgen=yes,no
  113. Generational GC support: Used to enable or disable the
  114. compilation of a Mono runtime with the SGen garbage collector.
  115. On platforms that support it, after building Mono, you
  116. will have both a mono binary and a mono-sgen binary.
  117. Mono uses Boehm, while mono-sgen uses the Simple
  118. Generational GC.
  119. --with-gc=[boehm, included, sgen, none]
  120. Selects the default Boehm garbage collector engine to
  121. use, the default is the "included" value.
  122. included:
  123. This is the default value, and its
  124. the most feature complete, it will allow Mono
  125. to use typed allocations and support the
  126. debugger.
  127. It is essentially a slightly modified Boehm GC
  128. boehm:
  129. This is used to use a system-install Boehm GC,
  130. it is useful to test new features available in
  131. Boehm GC, but we do not recommend that people
  132. use this, as it disables a few features.
  133. none:
  134. Disables the inclusion of a garbage
  135. collector.
  136. --with-tls=__thread,pthread
  137. Controls how Mono should access thread local storage,
  138. pthread forces Mono to use the pthread APIs, while
  139. __thread uses compiler-optimized access to it.
  140. Although __thread is faster, it requires support from
  141. the compiler, kernel and libc. Old Linux systems do
  142. not support with __thread.
  143. This value is typically pre-configured and there is no
  144. need to set it, unless you are trying to debug a
  145. problem.
  146. --with-sigaltstack=yes,no
  147. Experimental: Use at your own risk, it is known to
  148. cause problems with garbage collection and is hard to
  149. reproduce those bugs.
  150. This controls whether Mono will install a special
  151. signal handler to handle stack overflows. If set to
  152. "yes", it will turn stack overflows into the
  153. StackOverflowException. Otherwise when a stack
  154. overflow happens, your program will receive a
  155. segmentation fault.
  156. The configure script will try to detect if your
  157. operating system supports this. Some older Linux
  158. systems do not support this feature, or you might want
  159. to override the auto-detection.
  160. --with-static_mono=yes,no
  161. This controls whether `mono' should link against a
  162. static library (libmono.a) or a shared library
  163. (libmono.so).
  164. This defaults to yes, and will improve the performance
  165. of the `mono' program.
  166. This only affects the `mono' binary, the shared
  167. library libmono.so will always be produced for
  168. developers that want to embed the runtime in their
  169. application.
  170. --with-xen-opt=yes,no
  171. The default value for this is `yes', and it makes Mono
  172. generate code which might be slightly slower on
  173. average systems, but the resulting executable will run
  174. faster under the Xen virtualization system.
  175. --with-large-heap=yes,no
  176. Enable support for GC heaps larger than 3GB.
  177. This value is set to `no' by default.
  178. --enable-small-config=yes,no
  179. Enable some tweaks to reduce memory usage and disk footprint at
  180. the expense of some capabilities. Typically this means that the
  181. number of threads that can be created is limited (256), that the
  182. maxmimum heap size is also reduced (256 MB) and other such limitations
  183. that still make mono useful, but more suitable to embedded devices
  184. (like mobile phones).
  185. This value is set to `no' by default.
  186. --with-ikvm-native=yes,no
  187. Controls whether the IKVM JNI interface library is
  188. built or not. This is used if you are planning on
  189. using the IKVM Java Virtual machine with Mono.
  190. This defaults to `yes'.
  191. --with-profile4=yes,no
  192. Whether you want to build the 4.x profile libraries
  193. and runtime.
  194. It defaults to `yes'.
  195. --with-moonlight=yes,no
  196. Whether you want to generate the Silverlight/Moonlight
  197. libraries and toolchain in addition to the default
  198. (1.1 and 2.0 APIs).
  199. This will produce the `smcs' compiler which will reference
  200. the Silverlight modified assemblies (mscorlib.dll,
  201. System.dll, System.Code.dll and System.Xml.Core.dll) and turn
  202. on the LINQ extensions for the compiler.
  203. --with-libgdiplus=installed,sibling,<path>
  204. This is used to configure where should Mono look for
  205. libgdiplus when running the System.Drawing tests.
  206. It defaults to `installed', which means that the
  207. library is available to Mono through the regular
  208. system setup.
  209. `sibling' can be used to specify that a libgdiplus
  210. that resides as a sibling of this directory (mono)
  211. should be used.
  212. Or you can specify a path to a libgdiplus.
  213. --disable-shared-memory
  214. Use this option to disable the use of shared memory in
  215. Mono (this is equivalent to setting the MONO_DISABLE_SHM
  216. environment variable, although this removes the feature
  217. completely).
  218. Disabling the shared memory support will disable certain
  219. features like cross-process named mutexes.
  220. --enable-minimal=LIST
  221. Use this feature to specify optional runtime
  222. components that you might not want to include. This
  223. is only useful for developers embedding Mono that
  224. require a subset of Mono functionality.
  225. The list is a comma-separated list of components that
  226. should be removed, these are:
  227. aot:
  228. Disables support for the Ahead of Time
  229. compilation.
  230. attach:
  231. Support for the Mono.Management assembly and the
  232. VMAttach API (allowing code to be injected into
  233. a target VM)
  234. com:
  235. Disables COM support.
  236. debug:
  237. Drop debugging support.
  238. decimal:
  239. Disables support for System.Decimal.
  240. full_messages:
  241. By default Mono comes with a full table
  242. of messages for error codes. This feature
  243. turns off uncommon error messages and reduces
  244. the runtime size.
  245. generics:
  246. Generics support. Disabling this will not
  247. allow Mono to run any 2.0 libraries or
  248. code that contains generics.
  249. jit:
  250. Removes the JIT engine from the build, this reduces
  251. the executable size, and requires that all code
  252. executed by the virtual machine be compiled with
  253. Full AOT before execution.
  254. large_code:
  255. Disables support for large assemblies.
  256. logging:
  257. Disables support for debug logging.
  258. pinvoke:
  259. Support for Platform Invocation services,
  260. disabling this will drop support for any
  261. libraries using DllImport.
  262. portability:
  263. Removes support for MONO_IOMAP, the environment
  264. variables for simplifying porting applications that
  265. are case-insensitive and that mix the Unix and Windows path separators.
  266. profiler:
  267. Disables support for the default profiler.
  268. reflection_emit:
  269. Drop System.Reflection.Emit support
  270. reflection_emit_save:
  271. Drop support for saving dynamically created
  272. assemblies (AssemblyBuilderAccess.Save) in
  273. System.Reflection.Emit.
  274. shadow_copy:
  275. Disables support for AppDomain's shadow copies
  276. (you can disable this if you do not plan on
  277. using appdomains).
  278. simd:
  279. Disables support for the Mono.SIMD intrinsics
  280. library.
  281. ssa:
  282. Disables compilation for the SSA optimization
  283. framework, and the various SSA-based
  284. optimizations.
  285. --enable-llvm
  286. --enable-loadedllvm
  287. This enables the use of LLVM as a code generation engine
  288. for Mono. The LLVM code generator and optimizer will be
  289. used instead of Mono's built-in code generator for both
  290. Just in Time and Ahead of Time compilations.
  291. See the http://www.mono-project.com/Mono_LLVM for the
  292. full details and up-to-date information on this feature.
  293. You will need to have an LLVM built that Mono can link
  294. against,
  295. The --enable-loadedllvm variant will make the llvm backend
  296. into a runtime-loadable module instead of linking it directly
  297. into the main mono binary.
  298. --enable-big-arrays
  299. This enables the use arrays whose indexes are larger
  300. than Int32.MaxValue.
  301. By default Mono has the same limitation as .NET on
  302. Win32 and Win64 and limits array indexes to 32-bit
  303. values (even on 64-bit systems).
  304. In certain scenarios where large arrays are required,
  305. you can pass this flag and Mono will be built to
  306. support 64-bit arrays.
  307. This is not the default as it breaks the C embedding
  308. ABI that we have exposed through the Mono development
  309. cycle.
  310. --enable-parallel-mark
  311. Use this option to enable the garbage collector to use
  312. multiple CPUs to do its work. This helps performance
  313. on multi-CPU machines as the work is divided across CPUS.
  314. This option is not currently the default as we have
  315. not done much testing with Mono.
  316. --enable-dtrace
  317. On Solaris and MacOS X builds a version of the Mono
  318. runtime that contains DTrace probes and can
  319. participate in the system profiling using DTrace.
  320. --disable-dev-random
  321. Mono uses /dev/random to obtain good random data for
  322. any source that requires random numbers. If your
  323. system does not support this, you might want to
  324. disable it.
  325. There are a number of runtime options to control this
  326. also, see the man page.
  327. --enable-nacl
  328. This configures the Mono compiler to generate code
  329. suitable to be used by Google's Native Client:
  330. http://code.google.com/p/nativeclient/
  331. Currently this is used with Mono's AOT engine as
  332. Native Client does not support JIT engines yet.
  333. 2. Using Mono
  334. =============
  335. Once you have installed the software, you can run a few programs:
  336. * runtime engine
  337. mono program.exe
  338. * C# compiler
  339. mcs program.cs
  340. * CIL Disassembler
  341. monodis program.exe
  342. See the man pages for mono(1), mint(1), monodis(1) and mcs(2)
  343. for further details.
  344. 3. Directory Roadmap
  345. ====================
  346. docs/
  347. Technical documents about the Mono runtime.
  348. data/
  349. Configuration files installed as part of the Mono runtime.
  350. mono/
  351. The core of the Mono Runtime.
  352. metadata/
  353. The object system and metadata reader.
  354. mini/
  355. The Just in Time Compiler.
  356. dis/
  357. CIL executable Disassembler
  358. cli/
  359. Common code for the JIT and the interpreter.
  360. io-layer/
  361. The I/O layer and system abstraction for
  362. emulating the .NET IO model.
  363. cil/
  364. Common Intermediate Representation, XML
  365. definition of the CIL bytecodes.
  366. interp/
  367. Interpreter for CLI executables (obsolete).
  368. arch/
  369. Architecture specific portions.
  370. man/
  371. Manual pages for the various Mono commands and programs.
  372. samples/
  373. Some simple sample programs on uses of the Mono
  374. runtime as an embedded library.
  375. scripts/
  376. Scripts used to invoke Mono and the corresponding program.
  377. runtime/
  378. A directory that contains the Makefiles that link the
  379. mono/ and mcs/ build systems.
  380. ../olive/
  381. If the directory ../olive is present (as an
  382. independent checkout) from the Mono module, that
  383. directory is automatically configured to share the
  384. same prefix than this module gets.