Monoをsvn trunkのソースからビルドしてインストールする手順。 ビルドに使用した環境はUbuntu 9.10 RC Desktop。 本文は2009年10月26日現在のバージョンに基づく。

  • 関連するページ

ビルドにはgcc、libtool、autotools、gettext、pkg-config等が必要になるので、あらかじめインストールしておく必要がある。

libgdiplus

  • 依存するパッケージ類
    • libcairo2-dev
    • libexif-dev
    • libfreetype6-dev
    • libfontconfig1-dev
    • libglib2.0-dev
    • libjpeg62-dev
    • libpng12-dev
    • libtiff4-dev
    • libungif4-dev
    • libx11-dev
    • libxrender-dev

ソースのチェックアウトとautogen、configure。

svn co svn://anonsvn.mono-project.com/source/trunk/libgdiplus
cd ./libgdiplus
./autogen.sh --prefix=/usr/local

configureの結果例。

---
Configuration summary

   * Installation prefix = /usr/local
   * Cairo = 1.8.8 (system)
   * Text = cairo
   * EXIF tags = yes
   * Codecs supported:

      - TIFF: yes
      - JPEG: yes
      - GIF: yes
      - PNG: yes
      NOTE: if any of the above say 'no' you may install the
            corresponding development packages for them, rerun
            autogen.sh to include them in the build.

---
Now type `make' to compile

configureした結果に問題が無ければmake、make installする。

make
sudo make install

正しくインストールできたか確認する。

ls `pkg-config --variable=libdir libgdiplus`

Mono本体(コンパイラ、クラスライブラリ)

ソースのチェックアウトとautogen、configure。 .NET Framework 4のアセンブリを含めない場合は、--with-profile4をnoにする。

svn co svn://anonsvn.mono-project.com/source/trunk/mono svn://anonsvn.mono-project.com/source/trunk/mcs
cd mono
./autogen.sh --prefix=/usr/local --with-libgdiplus=installed --with-large-heap=yes --with-ikvm-native=no --with-moonlight=yes --with-profile2=yes --with-profile4=yes

configureの結果例。

        mcs source:    $(top_srcdir)/../mcs
        olive source:  

	GC:	       included
	GLIB:	       system
	TLS:           __thread
	SIGALTSTACK:   yes
	Engine:        Building and using the JIT
	Moon Profile:  yes
	4.0 Alpha:     yes
	MonoTouch:     no
	JNI support:   
	libgdiplus:    assumed to be installed
	zlib:          system zlib
	oprofile:      no
	BigArrays:     no
	DTrace:        no
	Parallel Mark: yes
	LLVM Back End: no
	


Now type `make' to compile

コンパイルする環境にMonoおよびmcsがない場合は、makeする前に最新のMonoLite(Mono Daily Packages)を取得しておく。

make get-monolite-latest

なお、このコマンドでから取得したバイナリでビルドできない場合は、以下の5つのバイナリを別の環境からコピーするなどして../mcs/class/lib/monolite/に配置すればビルドできるようになる。

  • mscorlib.dll
  • System.dll
  • System.Xml.dll
  • Mono.Security.dll
  • mcs.exe

準備が整ったら、make、make installする。

make
sudo make install

動作確認

インストールが完了したら、mono -Vでmonoが動作することを確認する。

$ mono -V
Mono JIT compiler version 2.7 (/trunk/mono r144827 2009年 10月 26日 月曜日 04:53:08 JST)
Copyright (C) 2002-2009 Novell, Inc and Contributors. www.mono-project.com
	TLS:           __thread
	GC:            Included Boehm (with typed GC and Parallel Mark)
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  x86
	Disabled:      none

またgacutil -lでアセンブリがGACに登録されていることを確認する。

$ gacutil -l
The following assemblies are installed into the GAC:
  :
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.ComponentModel.DataAnnotations, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  :

gmcs --aboutでgmcsのバージョンを確認する。

$ gmcs --about
The Mono C# compiler is Copyright 2001-2008, Novell, Inc.

The compiler source code is released under the terms of the 
MIT X11 or GNU GPL licenses

For more information on Mono, visit the project Web site
   http://www.mono-project.com

The compiler was written by Miguel de Icaza, Ravi Pratap, Martin Baulig, Marek Safar, Raja R Harinath, Atushi Enomoto

csharpシェルが動作するか確認する。

$ csharp
Mono C# Shell, type "help;" for help

Enter statements below.
csharp> Console.WriteLine(Environment.Version);
2.0.50727.1433
csharp> Console.WriteLine(Environment.OSVersion);
Unix 2.6.31.14
csharp> quit;
null

gluezilla

  • 依存するパッケージ類
    • libgtk2.0-dev
    • libnss3-dev
    • libnspr4-dev
    • libxul-devもしくはxulrunner-dev

ソースのチェックアウトとautogen、configure。

svn co svn://anonsvn.mono-project.com/source/trunk/gluezilla
cd ./gluezilla
./autogen.sh --prefix=/usr/local

configureの結果例。

checking Gtk+ 2.0... found
checking Mono... found
checking Mozilla NSPR... nspr
checking Mozilla NSS... nss
checking Mozilla XPCOM > 1.8... libxul-embedding-unstable
  :
Now type `make' to compile

問題が無ければ、make、make installする。

make
sudo make install

gluezillaの動作テスト

gluezillaが動作するかテストしたい場合は、tests/browser/にあるテスト用のアプリケーションをビルド・起動して動作を確認できる。

まず、ldconfigでライブラリのリンク・キャッシュを再構成する。

sudo ldconfig

次に、テスト用のMakefileで指定されているアセンブリ参照の誤りを修正する。

$ cd tests/browser/
$ diff Makefile.org Makefile
348c348
< 	gmcs -debug -pkg:dotnet -r:Mono.Mozilla.dll -target:exe -out:$@ $(test_build_sources)
---
> 	gmcs -debug -pkg:dotnet -r:Mono.WebBrowser.dll -target:exe -out:$@ $(test_build_sources)

修正後、make testでテスト用のアプリケーションが起動する。 起動するとウィンドウが開くので、アドレスバーに適当なURLを入れてページが表示されるか確認する。

Mono.Addins

  • 依存するパッケージ類
    • gtk-sharp-2.0

ソースのチェックアウトとautogen、configure。

svn co svn://anonsvn.mono-project.com/source/trunk/mono-addins
cd mono-addins/
./autogen.sh

configureの結果例。

Configuration summary

   * Installation prefix = /usr/local
   * gui support: yes
   * unit tests: no
   * documentation: no

問題が無ければ、make、make installする。

make
sudo make install

mono-tools

  • 依存するパッケージ類
    • gtk-sharp-2.0
    • gnome-sharp(2.0または3.14)
  • オプションで参照されるパッケージ類
    • gecko-sharp
    • gtkhtml-sharp
    • webkit-sharp

ソースのチェックアウトとautogen、configure。

svn co svn://anonsvn.mono-project.com/source/trunk/mono-tools
cd mono-tools/
./autogen.sh

configureの結果例。

---
Configuration summary

   * Installation prefix = /usr/local
   * Using Gecko = yes
   * Using GtkHtml = yes
   * Using Mono.WebBrowser = yes
   * Using WebKit = no

      NOTE: if any of the above say 'no' you may install the
            corresponding development packages for them, rerun
            autogen.sh to include them in the build.

問題が無ければ、make、make installする。

make
sudo make install

mono-debugger

  • 依存するパッケージ類
    • libncurses5-dev

ソースのチェックアウトとautogen、configure。

svn co svn://anonsvn.mono-project.com/source/trunk/debugger mono-debugger
cd mono-debugger
./autogen.sh

configureの結果に問題が無ければ、make、make installする。

make
sudo make install

メモ

Ubuntu 9.10 Server用

Ubuntu 9.10 Serverインストール直後の状態から、JITコンパイラ・C#コンパイラ・ランタイム(.NET 4含まず)のみをビルド・インストールする手順。

$ sudo apt-get install build-essential bison autoconf automake1.9 libtool libglib2.0-dev gettext
$ svn co svn://anonsvn.mono-project.com/source/trunk/mono svn://anonsvn.mono-project.com/source/trunk/mcs
$ cd mono
$ ./autogen.sh --prefix=/usr/local --with-libgdiplus=installed --with-large-heap=no --with-ikvm-native=no --with-monotouch=no --with-moonlight=no --with-profile2=yes --with-profile4=no
$ make get-monolite-latest
$ make
$ sudo make install