特殊:Badtitle/NS100:MonoFromSource
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/MonoFromSource }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/af | • {{#if: UbuntuHelp:MonoFromSource|Afrikaans| [[::MonoFromSource/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/ar | • {{#if: UbuntuHelp:MonoFromSource|العربية| [[::MonoFromSource/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/az | • {{#if: UbuntuHelp:MonoFromSource|azərbaycanca| [[::MonoFromSource/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/bcc | • {{#if: UbuntuHelp:MonoFromSource|جهلسری بلوچی| [[::MonoFromSource/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/bg | • {{#if: UbuntuHelp:MonoFromSource|български| [[::MonoFromSource/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/br | • {{#if: UbuntuHelp:MonoFromSource|brezhoneg| [[::MonoFromSource/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/ca | • {{#if: UbuntuHelp:MonoFromSource|català| [[::MonoFromSource/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/cs | • {{#if: UbuntuHelp:MonoFromSource|čeština| [[::MonoFromSource/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/de | • {{#if: UbuntuHelp:MonoFromSource|Deutsch| [[::MonoFromSource/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/el | • {{#if: UbuntuHelp:MonoFromSource|Ελληνικά| [[::MonoFromSource/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/es | • {{#if: UbuntuHelp:MonoFromSource|español| [[::MonoFromSource/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/fa | • {{#if: UbuntuHelp:MonoFromSource|فارسی| [[::MonoFromSource/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/fi | • {{#if: UbuntuHelp:MonoFromSource|suomi| [[::MonoFromSource/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/fr | • {{#if: UbuntuHelp:MonoFromSource|français| [[::MonoFromSource/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/gu | • {{#if: UbuntuHelp:MonoFromSource|ગુજરાતી| [[::MonoFromSource/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/he | • {{#if: UbuntuHelp:MonoFromSource|עברית| [[::MonoFromSource/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/hu | • {{#if: UbuntuHelp:MonoFromSource|magyar| [[::MonoFromSource/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/id | • {{#if: UbuntuHelp:MonoFromSource|Bahasa Indonesia| [[::MonoFromSource/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/it | • {{#if: UbuntuHelp:MonoFromSource|italiano| [[::MonoFromSource/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/ja | • {{#if: UbuntuHelp:MonoFromSource|日本語| [[::MonoFromSource/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/ko | • {{#if: UbuntuHelp:MonoFromSource|한국어| [[::MonoFromSource/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/ksh | • {{#if: UbuntuHelp:MonoFromSource|Ripoarisch| [[::MonoFromSource/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/mr | • {{#if: UbuntuHelp:MonoFromSource|मराठी| [[::MonoFromSource/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/ms | • {{#if: UbuntuHelp:MonoFromSource|Bahasa Melayu| [[::MonoFromSource/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/nl | • {{#if: UbuntuHelp:MonoFromSource|Nederlands| [[::MonoFromSource/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/no | • {{#if: UbuntuHelp:MonoFromSource|norsk| [[::MonoFromSource/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/oc | • {{#if: UbuntuHelp:MonoFromSource|occitan| [[::MonoFromSource/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/pl | • {{#if: UbuntuHelp:MonoFromSource|polski| [[::MonoFromSource/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/pt | • {{#if: UbuntuHelp:MonoFromSource|português| [[::MonoFromSource/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/ro | • {{#if: UbuntuHelp:MonoFromSource|română| [[::MonoFromSource/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/ru | • {{#if: UbuntuHelp:MonoFromSource|русский| [[::MonoFromSource/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/si | • {{#if: UbuntuHelp:MonoFromSource|සිංහල| [[::MonoFromSource/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/sq | • {{#if: UbuntuHelp:MonoFromSource|shqip| [[::MonoFromSource/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/sr | • {{#if: UbuntuHelp:MonoFromSource|српски / srpski| [[::MonoFromSource/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/sv | • {{#if: UbuntuHelp:MonoFromSource|svenska| [[::MonoFromSource/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/th | • {{#if: UbuntuHelp:MonoFromSource|ไทย| [[::MonoFromSource/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/tr | • {{#if: UbuntuHelp:MonoFromSource|Türkçe| [[::MonoFromSource/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/vi | • {{#if: UbuntuHelp:MonoFromSource|Tiếng Việt| [[::MonoFromSource/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/yue | • {{#if: UbuntuHelp:MonoFromSource|粵語| [[::MonoFromSource/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/zh | • {{#if: UbuntuHelp:MonoFromSource|中文| [[::MonoFromSource/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/zh-hans | • {{#if: UbuntuHelp:MonoFromSource|中文(简体)| [[::MonoFromSource/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:MonoFromSource | UbuntuHelp:MonoFromSource | {{#if: | :}}MonoFromSource}}/zh-hant | • {{#if: UbuntuHelp:MonoFromSource|中文(繁體)| [[::MonoFromSource/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:MonoFromSource|:MonoFromSource|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :MonoFromSource/zh | | {{#ifexist: MonoFromSource/zh | | {{#ifeq: {{#titleparts:MonoFromSource|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:MonoFromSource|1|-1|}} | zh | | }}
Compiling Mono From Source
Due to the current lag between Mono releases and Ubuntu/Debian packages being available, this page will help you to compile the latest release of Mono from source. These instructions are for use with Ubuntu 5.04 (Hoary Hedgehog), Ubuntu 5.10 forwards already has a more recent version of Mono in the repositories.
Pre-Requisites
Since we're going to be compiling code, we need to satisfy some requirements before we begin. We also need to satisfy some dependencies for Mono.
bash:~$ sudo apt-get install build-essential pkg-config libglib2.0-dev bison libcairo1-dev
Now we're going to need somewhere to work:
bash:~$ mkdir src bash:~$ cd src
libgdiplus
Optional - Although the following are not required, they do provide more functionality to libgdiplus.
bash:~/src/$ sudo apt-get install libungif4-dev libjpeg62-dev libtiff4-dev
Let's grab the tarball:
bash:~/src/$ wget http://www.go-mono.com/sources/libgdiplus-1.1/libgdiplus-1.1.9.tar.gz
...and extract it:
bash:~/src/$ tar xzf libgdiplus-1.1.9.tar.gz bash:~/src/$ cd libgdiplus-1.1.9
Now we can compile and install it:
bash:~/src/libgdiplus-1.1.9/$ ./configure --prefix=/usr/local bash:~/src/libgdiplus-1.1.9/$ make bash:~/src/libgdiplus-1.1.9/$ sudo make install
Now we have to make sure the installed libraries are visible - there are several ways to do this, this is just one.
bash:~/src/libgdiplus-1.1.9/$ sudo sh -c "echo /usr/local/lib >> /etc/ld.so.conf" bash:~/src/libgdiplus-1.1.9/$ sudo /sbin/ldconfig
Now we can leave this folder...
bash:-~/src/libgdiplus-1.1.9/$ cd ..
...and move onto the next step.
Mono
Compiling Mono itself is pleasantly straightforward:
bash:~/src/$ wget http://www.go-mono.com/sources/mono-1.1/mono-1.1.9.tar.gz bash:~/src/$ tar xzf mono-1.1.9.tar.gz bash:~/src/$ cd mono-1.1.9 bash:~/src/mono-1.1.9/$ ./configure --prefix=/usr/local --with-preview=yes bash:~/src/mono-1.1.9/$ make bash:~/src/mono-1.1.9/$ sudo make install bash:~/src/$ cd ..
You can check the install as follows:
bash:~/src/$ mono -V Mono JIT compiler version 1.1.9, (C) 2002-2005 Novell, Inc and Contributors. www.mono-project.com TLS: normal GC: Included Boehm (with typed GC) SIGSEGV : normal Globalization: normal
Gtk#
There are two variants of Gtk# - 1.x and 2.x. Different applications may require one or the other, and due to the nature of Mono there is no harm in having both. Both depend on various GNOME/GTK+ development libraries, which can be satisified as follows:
bash:~/src/$ sudo apt-get install libgnome-desktop-dev libgtkhtml3.2-dev
There are also optional dependencies, which - if you require them - can be satisified with:
bash:~/src/$ sudo apt-get install libgnomedb2-dev librsvg2-dev libvte-dev
As with Mono itself once you've satisfied the dependencies, compilation is straight forward.
1.x
bash:~/src/$ wget http://go-mono.com/sources/gtk-sharp/gtk-sharp-1.0.10.tar.gz bash:~/src/$ tar xzf gtk-sharp-1.0.10.tar.gz bash:~/src/$ cd gtk-sharp-1.0.10 bash:~/src/gtk-sharp-1.0.10/$ ./configure --prefix=/usr/local bash:~/src/gtk-sharp-1.0.10/$ make bash:~/src/gtk-sharp-1.0.10/$ sudo make install bash:~/src/$ cd ..
You can test your install with the following:
bash:~/src/$ sudo ldconfig bash:~/src/$ mono gtk-sharp-1.0.10/sample/GtkDemo/GtkDemo.exe
2.x
Gtk# 2.x has an additional dependency:
bash:~/src/$ sudo apt-get install libpanel-applet2-dev
bash:~/src/$ wget http://go-mono.com/sources/gtk-sharp-2.0/gtk-sharp-2.3.91.tar.gz bash:~/src/$ tar xzf gtk-sharp-2.3.91.tar.gz bash:~/src/$ cd gtk-sharp-2.3.91 bash:~/src/gtk-sharp-2.3.91/$ ./configure --prefix=/usr/local bash:~/src/gtk-sharp-2.3.91/$ make bash:~/src/gtk-sharp-2.3.91/$ sudo make install bash:~/src/$ cd ..
You can test your install with the following:
bash:~/src/$ sudo ldconfig bash:~/src/$ mono gtk-sharp-2.3.91/sample/GtkDemo/GtkDemo.exe
Conclusion
You've now got a fully functioning Mono/Gtk# environment, and you can move onto compiling/developing your own applications!