Ubuntu 8.04 (hardy heron) に mono 2.4 をインストール

我が家のメインサーバーである Ubuntu 8.04 (近々 OpenSUSE にリプレース予定) に mono 2.4 をインストールしてみたのでメモ。

Ubuntu 8.04 の公式パッケージなどでは mono 1.x になってしまうので、ソースからビルドした。

環境とインストール後の状態

% uname -a
Linux NEC-1 2.6.24-16-generic #1 SMP Thu Apr 10 12:47:45 UTC 2008 x86_64 GNU/Linux

% lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 8.04.2
Release:	8.04
Codename:	hardy
% mono -V
Mono JIT compiler version 2.4 (tarball 2009年  5月  5日 火曜日 05:18:44 JST)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
	TLS:           __thread
	GC:            Included Boehm (with typed GC)
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
 % gmcs --version
Mono C# compiler version 2.4.0.0

やったこと

ほとんど、こちらのサイトを参考にひたすら configure, make, make install しただけである: http://smdn.invisiblefulmoon.net/programming/mono/install_2.4/

上のサイトは Ubuntu 9.04 対象だが、Ubuntu 8.04 でも同様の手順でほぼ問題なくインストール完了した。

問題など

事前にインストール済みの mono を apt-get remove した

手でインストールした mono と共存しても大丈夫かもしれないが、共存させる意味もあまり感じられないので、apt-get install してあった mono は消した。

mono-tools の make で "An exception was thrown by the type initializer for System.Drawing.GDIPlus" となってコケる

以前書いたこのエントリと同じ話である: OS X に macports でインストールした mono で Graphics や Forms を使うための設定 - やこ〜ん SuperNova2

対処法としては、~/.mono/config に

<configuration>
        <dllmap dll="gdiplus.dll" target="/usr/local/lib/libgdiplus.so"/>
</configuration>

と書いておけばよい(当然ながら事前に libgdiplus のインストールが必要である)。

こうすることで、gdiplus.dll を発見できないためにコケているところを、gdiplus.dll の代わりに libgdiplus.so をロードさせることで解決できるようになる。

gnome-desktop-sharp が gtksourceview2-sharp.dll: no と主張する

gnome-desktop-sharp の configure にて、

% gacutil -l | grep source
gtksourceview-sharp, Version=1.0.0.2, Culture=neutral, PublicKeyToken=35e10195dab3c99f
gtksourceview2-sharp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f

という風に、gtksourceview2 がインストールされているはずであるにも関わらず、

   Optional assemblies included in the build:

      * gtkhtml-sharp.dll: yes
      * gtksourceview2-sharp.dll: no
      * nautilusburn-sharp.dll: yes
      * rsvg-sharp.dll: yes
      * vte-sharp.dll: yes
      * wnck-sharp.dll: yes

となってしまう問題がある。

gacutil -l では出てくるのに見つからないあたり、何か問題があるのだろうが、今のところ gtk / mono なアプリを触る予定が無い上、おなかが減ったのでとりあえず放置してある。

おそらく、gtksourceview を使えないことで MonoDevelop などで困るだけだと思うので、後日気が向いたらどうにかする予定。