从源代码编译安装 Mono 2.4 和 MonoDevelop 2.0

虽然现在几乎所有的Linux发行版都预置了Mono软件,但是大多数都比较旧,因此要体验最新版本的Mono,还是要用源代码自己进行编译安装的。

先说几句废话,Mono 2.4 提供了.Net 3.5 的大部分功能  (Linq、扩展方法),提供了完整的ASP.NET支持, Novell宣布开始提供商业支持,著名的控件提供商(Telerik)也开始支持Mono下的ASP.Net 控件,可以说现在Mono已经日臻完善,有一定的研究意义。

接下来熟悉一下在 Linux 下从源代码编译安装软件的基本命令:
1. configure: 根据系统当前的配置,生成编译所需的配置文件;
2. make:根据configure生成的配置文件,进行编译;
3. make install :安装编译生成的文件,通常是将生成的文件复制到预定的位置;
4. make uninstall :删除从源代码编译安装的文件,通常和 make install配合使用。

下载 Mono 和 MonoDevelop 必需的源代码包如下:
 image

接下来按照下面的顺序安装:
1. 安装libgdiplus(Linux系统下gdi+的实现):打开一个命令行窗口,切换到libgdiplus-2.4所在的目录,输入 ./configure 进行配置,如果提示说缺少什么开发库的话,则需要先安装相应的开发库,可以去相应的Linux发行版的软件库中去找已经编译好的,可以从源代码安装。最后直到输出的内容和下面差不多时,才可以继续。

---------------------
Configuration summary

   * Installation prefix = /opt/mono
   * Cairo = 1.8.0 (system)
   * Text = pango
   * 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.

-----------------

得到上面的提示之后,再执行make 命令,进行编译,这个将需要一段时间,如果没有什么意外的话,一般都会编译成功的。

编译成功之后,执行make install命令,进行安装。如果安装出错的话,可以执行make uninstall命令卸载,然后重新安装。

接下来按照如下的顺序依次安装,因为有依赖关系,最好不要打乱。
mono-2.4, gtk-sharp-2.12.8, gnome-sharp-2.20.1,Mono-Addins-2.4,  xsp-2.4, mono-debugger-2.4, monodevelop-2.0, monodevelop-database-2.0, monodevelop-debugger-gdb-2.0, monodevelop-debugger-mdb-2.0 。

现在一个完整的Mono开发环境已经基本完成,如果运行WinForm程序的话,可能会遇到找不到libgdiplus的DllNotFoundException,则可以参考Mono网站提供的的解决方法

测试一下安装的结果吧,打开一个命令行窗口,输入mono --version,可以看到如下的提示:

Mono JIT compiler version 2.4 (tarball Sat Apr 11 21:46:46 CST 2009)
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:  x86
	Disabled:      none

接着输入monodevelop,会看到monodevelop的启动,启动之后如下图
image

posted @ 2009-05-09 17:43  张志敏  阅读(3374)  评论(6编辑  收藏  举报