之所以用源码编译的方式安装mono和monodevelop,是因为通过yum安装的mono不是最新版本,而且monodevelop不能建 asp.net MVC3的工程。

而且通过源码安装,可以进一步了解mono的各个项目之间的关系。

我用的Fedora16系统

1.  mono的源码编译安装

下载mono的最新源码,github上的源码编译时总是报找不到 gmcs.exe的错误。

我是在mono的官网上下的最新源码,地址:https://wrench.mono-project.com/Wrench/index.aspx?show_all=true

我下的是mono-2.11.3版

    # tar jxvf mono-2.11.3.tar.bz2
    # cd mono-2.11.3
    # ./autogen.sh --prefix=/usr/local
    # make
    # make install

需要注意的是用root用户来安装,否则有错误。

2. monodevelop的源码编译安装

monodevelop的源码编译安装相当曲折,搞了好几天。

有几点需要注意:

  1. 在monodevelop的官网上下最新源码,否则在./configure时会有找不到文件的错。
  2. 在安装monodevelop之前,要先安装一些依赖的包。(mono-addins,gtk-sharp,libglade2,gnome-sharp-2.0)
  3. 安装完后,需要设置LD_LIBRARY_PATH这个环境变量
  4. 用root用户来安装

安装monodevelop之前,按顺序安装一些依赖包:

(gtk-sharp  --> mono-addins --> libglade2--> gnome-sharp-2.0)

这些包在安装时也会遇到各种问题,下面是我安装时遇到的各种问题及解决方法,供参考。

以上的安装顺序是我总结出来的,没有试验过。

我安装时并不知道上面的安装顺序,是直接安装monodevelop,然后遇到问题再解决的。我的安装顺序如下:

1) 和mono同样的网址下载monodevelop的最新代码。

    # tar jxvf monodevelop-3.1.0.tar.bz2
    # cd monodevelop-3.1.0
    # ./configure --prefix=`pkg-config --variable=prefix mono`

此时报了一个错误如下:找不到 UNMANAGED_DEPENDENCIES_MONO

====================================================================
[root@localhost monodevelop-3.1.0]# ./configure --prefix=`pkg-config --variable=prefix mono`
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... no
checking for mono... /usr/local/bin/mono
checking for gmcs... /usr/local/bin/gmcs
checking for update-mime-database... /usr/bin/update-mime-database
checking for pkg-config... /usr/bin/pkg-config
checking for msgfmt... /usr/bin/msgfmt
checking for msgmerge... /usr/bin/msgmerge
checking pkg-config is at least version 0.9.0... yes
checking for UNMANAGED_DEPENDENCIES_MONO... no
configure: error: Please install mono version 2.8 or later to install MonoDevelop.
Please see http://www.mono-project.org/ to download latest mono sources or packages
====================================================================

通过以下命令修复此错误:

# export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig

参考网址: http://mono.1490590.n4.nabble.com/can-t-install-monodevelop-1-9-1-after-installed-mono-2-4-preview2-td1516079.html

再次执行:

# ./configure --prefix=`pkg-config --variable=prefix mono`

此时报了一个错误如下:找不到 mono-addins

====================================================================
checking for UNMANAGED_DEPENDENCIES_MONO... yes
checking for mono... /usr/local/bin/mono
checking for dmcs... /usr/local/bin/dmcs
checking for MONO_ADDINS... no
configure: error: Package requirements (mono-addins >= 0.6) were not met:
 
No package 'mono-addins' found
 
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
 
Alternatively, you may set the environment variables MONO_ADDINS_CFLAGS
and MONO_ADDINS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
====================================================================

下载mono-addins并安装,
下载地址: http://download.mono-project.com/sources/mono-addins/

    # tar jxvf mono-addins-0.6.2.tar.bz2
    # cd mono-addins-0.6.2
    # ./configure --prefix=/usr/local

此时报了一个错误如下:找不到 gtk-sharp-2.0

====================================================================
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... no
checking for pkg-config... /usr/bin/pkg-config
checking for a BSD-compatible install... /usr/bin/install -c
checking for gmcs... /usr/local/bin/gmcs
checking for gacutil... /usr/local/bin/gacutil
checking for al... /usr/local/bin/al
checking pkg-config is at least version 0.9.0... yes
checking for GTK_SHARP_20... configure: error: Package requirements (gtk-sharp-2.0) were not met:
 
No package 'gtk-sharp-2.0' found
 
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
 
Alternatively, you may set the environment variables GTK_SHARP_20_CFLAGS
and GTK_SHARP_20_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
====================================================================

下载gtk-sharp并安装,
下载地址: http://download.mono-project.com/sources/gtk-sharp212/

    # tar jxvf gtk-sharp-2.12.11.tar.bz2
    # cd gtk-sharp-2.12.11
    # ./configure --prefix=/usr/local
    # make
    # make install

gtk-sharp安装成功后,接着安装mono-addins

    # cd ../mono-addins-0.6.2
    # ./configure --prefix=/usr/local
    # make
    # make install

mono-addins安装成功后,接着安装monodevelop

    # cd ../monodevelop-3.1.0
    # ./configure --prefix=`pkg-config --variable=prefix mono`

此时报了一个错误如下:找不到 glade-sharp-2.0

====================================================================
[root@localhost monodevelop-3.1.0]# ./configure --prefix=`pkg-config --variable=prefix mono`
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... no
checking for mono... /usr/local/bin/mono
checking for gmcs... /usr/local/bin/gmcs
checking for update-mime-database... /usr/bin/update-mime-database
checking for pkg-config... /usr/bin/pkg-config
checking for msgfmt... /usr/bin/msgfmt
checking for msgmerge... /usr/bin/msgmerge
checking pkg-config is at least version 0.9.0... yes
checking for UNMANAGED_DEPENDENCIES_MONO... yes
checking for mono... /usr/local/bin/mono
checking for dmcs... /usr/local/bin/dmcs
checking for MONO_ADDINS... yes
checking for MONO_ADDINS_SETUP... yes
checking for MONO_ADDINS_GUI... yes
checking for GLIB_SHARP... yes
checking for GTK_SHARP... yes
checking for GLADE_SHARP... no
configure: error: Package requirements (glade-sharp-2.0 >= 2.12.8) were not met:
 
No package 'glade-sharp-2.0' found
 
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
 
Alternatively, you may set the environment variables GLADE_SHARP_CFLAGS
and GLADE_SHARP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
====================================================================

我不知道glade-sharp是什么包,先安装了libgdiplus

下载libgdiplus并安装,
下载地址: http://download.mono-project.com/sources/libgdiplus/

    # tar jxvf libgdiplus-2.10.9.tar.bz2
    # cd libgdiplus-2.10.9
    # ./configure --prefix=/usr/local
    # make

make时报了一个错误如下:

====================================================================
/usr/lib64/libglib-2.0.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [testgdi] Error 1
make[2]: Leaving directory `/usr/local/src/libgdiplus-2.10.9/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/libgdiplus-2.10.9'
make: *** [all] Error 2
====================================================================

解决办法如下:
(参考网址: http://www.sgvulcan.com/libgdiplus-2-10-9-build-fails-on-slacware-current64-2012-06/)
1. 运行./configure --prefix=/usr/local 之后,编辑 tests/Makefile 文件
2. 在Makefile文件130行位置,将   LIBS = -lpthread -lfontconfig
                            改为 LIBS = -lpthread -lfontconfig -lglib-2.0 -lX11
3. 再次运行 make 即可

    # make
    # make install

接着安装monodevelop

    # cd ../monodevelop-3.1.0
    # ./configure --prefix=`pkg-config --variable=prefix mono`

仍然是错误:找不到 glade-sharp-2.0
利用yum 安装libglade2-devel,mono源码中没找到这个包
参考网址: http://mono.1490590.n4.nabble.com/Monodevelop-2-4-compilation-error-quot-No-package-glade-sharp-2-0-found-quot-td2268343.html

    # yum search libglade2
    # yum install libglade2-devel.x86_64

知道这个包的名称,也可以找相应的rpm来安装。

安装完libglade2后,重新安装 gtk-sharp2,安装方法上面已有。
接着,再次尝试安装 monodevelop:

    # ./configure --prefix=`pkg-config --variable=prefix mono`

此时报了一个错误如下:未安装gnome-sharp-2.0

====================================================================
[root@localhost monodevelop-3.1.0]# ./configure --prefix=`pkg-config --variable=prefix mono`
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... no
checking for mono... /usr/local/bin/mono
checking for gmcs... /usr/local/bin/gmcs
checking for update-mime-database... /usr/bin/update-mime-database
checking for pkg-config... /usr/bin/pkg-config
checking for msgfmt... /usr/bin/msgfmt
checking for msgmerge... /usr/bin/msgmerge
checking pkg-config is at least version 0.9.0... yes
checking for UNMANAGED_DEPENDENCIES_MONO... yes
checking for mono... /usr/local/bin/mono
checking for dmcs... /usr/local/bin/dmcs
checking for MONO_ADDINS... yes
checking for MONO_ADDINS_SETUP... yes
checking for MONO_ADDINS_GUI... yes
checking for GLIB_SHARP... yes
checking for GTK_SHARP... yes
checking for GLADE_SHARP... yes
checking for MONODOC... yes
checking for GNOME_SHARP... no
checking for GNOME_VFS_SHARP... no
checking for GCONF_SHARP... no
configure: error: Cannot enable GNOME platform without gnome-sharp-2.0
====================================================================

下载 gnome-sharp-2.0 并安装
下载地址: http://download.mono-project.com/sources/gnome-sharp220/

    # tar jxvf gnome-sharp-2.20.1.tar.bz2
    # cd gnome-sharp-2.20.1
    # ./configure --prefix=/usr/local

虽然没有报错,但是提示缺少3个assmely: art-sharp.dll,gnomevfs-sharp.dll,gnome-sharp.dll

====================================================================
Configuration summary
 
   * Installation prefix = /usr/local
   * C# compiler: /usr/local/bin/mcs  -define:GTK_SHARP_2_6 -define:GTK_SHARP_2_8 -define:GNOME_SHARP_2_16 -define:GNOME_SHARP_2_20
 
   Optional assemblies included in the build:
 
      * art-sharp.dll: no
      * gnomevfs-sharp.dll: no
      * gnome-sharp.dll: 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.
 
            gnome-sharp.dll requires libgnomecanvas, libgnome,
            libgnomeui, libgnomeprint, libgnomeprintui, and
            libpanelapplet.
====================================================================

下面的两个dll对应如下库:(我是通过 yum找到的)
art-sharp.dll             : libart_lgpl-devel
gnomevfs-sharp.dll: gnome-vfs2-devel
最后一个根据上面的提示,(对应如下库)
gnome-sharp.dll   : libgnomecanvas, libgnome,
            libgnomeui, libgnomeprint, libgnomeprintui, and
            libpanelapplet(即gnome-panel-devel)

    # make

make 后,报出如下错误:

====================================================================
error CS0006: Metadata file `Mono.GetOptions.dll' could not be found
====================================================================

经过调查,
1.  原来是gnome-sharp版本太旧的原因,
    前面用的gnome-sharp-2.20.*用了Mono.GetOptions,更新至gnome-sharp-2.24.*
2.  注释掉gnome-sharp-2.24.1/sample/gnomevfs/Makefile中关于 Mono.GetOptions的内容
参考网址: http://www.puppeter.cn/?p=1126

下载地址:http://download.mono-project.com/sources/gnome-sharp2/

    # tar jxvf gnome-sharp-2.24.1.tar.bz2
    # cd gnome-sharp-2.24.0
    # ./configure --prefix=/usr/local
    # make
    # make install

接着,再次尝试安装 monodevelop:

    # ./configure --prefix=`pkg-config --variable=prefix mono`

此时会产生一些找不到 tests/UnitTests/Makefile.in 之类的错误。
经过调查,似乎是monodevelop 版本的问题,在monodevelop官网上下载最新的代码,
然后重新安装,终于安装成功。官网上最新版是3.0.3.4

    # tar jxvf monodevelop-3.0.3.4.tar.bz2
    # cd ../monodevelop-3.0.3.4
    # ./configure --prefix=`pkg-config --variable=prefix mono`
    # make
    # make install

安装完后,monodevep却无法启动,错误如下:

====================================================================
System.TypeInitializationException: An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---> System.DllNotFoundException: libMonoPosixHelper.so
  at (wrapper managed-to-native) Mono.Unix.Native.Syscall:_L_ctermid ()
  at Mono.Unix.Native.Syscall..cctor () [0x00032] in /home/wangyb/downloads/mono/mono-2.11.3/mcs/class/Mono.Posix/Mono.Unix.Native/Syscall.cs:2599 
  --- End of inner exception stack trace ---
  at MonoDevelop.Core.LoggingService.RedirectOutputToFileUnix (FilePath logDirectory, System.String logName) [0x0001f] in /home/wangyb/downloads/mono/monodevelop-3.0.3.4/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs:177 
  at MonoDevelop.Core.LoggingService.RedirectOutputToLogFile () [0x00046] in /home/wangyb/downloads/mono/monodevelop-3.0.3.4/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs:140 
FATAL ERROR [2012-07-29 07:59:49Z]: MonoDevelop failed to start. Some of the assemblies required to run MonoDevelop (for example gtk-sharp, gnome-sharp or gtkhtml-sharp) may not be properly installed in the GAC.
System.TypeInitializationException: An exception was thrown by the type initializer for Gtk.Application ---> System.DllNotFoundException: glibsharpglue-2
  at (wrapper managed-to-native) GLib.Thread:glibsharp_g_thread_supported ()
  at GLib.Thread.get_Supported () [0x00000] in <filename unknown>:0 
  at Gtk.Application..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at MonoDevelop.Ide.IdeStartup.Run (MonoDevelop.Ide.MonoDevelopOptions options) [0x00085] in /home/wangyb/downloads/mono/monodevelop-3.0.3.4/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:95 
  at MonoDevelop.Ide.IdeStartup.Main (System.String[] args) [0x00058] in /home/wangyb/downloads/mono/monodevelop-3.0.3.4/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:503 
====================================================================

将LD_LIBRARY_PATH加入到启动的配置文件中,即 ~/.bashrc
内容如下:

    # add mono LD_LIBRARY_PATH
    export LD_LIBRARY_PATH=/usr/local/lib

终于启动成功,也有 aspnet-mvc3的工程了 ^_^

3. 总结

记录下安装过程的错误,也是方便以后遇到相同的错误可以知道怎么解决。

大家在安装过程中如果有什么新的问题,欢迎交流。

本文转自wang_yb博客园博客,原文链接:http://www.cnblogs.com/wang_yb/archive/2012/07/29/2613844.html,如需转载请自行联系原作者

mono和monodevelop源码编译安装相关推荐

  1. mac通过tree源码编译安装tree

    通过tree源码编译安装  下载源码:curl -O ftp://mama.indstate.edu/linux/tree/tree-1.6.0.tgz  解压源码:tar xzvf tree-1.6 ...

  2. 源码编译安装percona-xtrabackup-2.3.2

    一.系统包需求 rpm -q libaio-devel libgpg-error-devel libgcrypt-devel autoconf automake libidn-devel libcur ...

  3. 如何在ARM开发板上从源码编译安装OpenCV和OpenCV contrib

    点击上方"3D视觉工坊",选择"星标" 干货第一时间送达 本文主要介绍如何在ARM开发板上从源码编译安装OpenCV和OpenCV contrib. OpenC ...

  4. 烂泥:mysql5.5数据库cmake源码编译安装

    本文首发于烂泥行天下. 以前也写过一篇有关mysql5.0源码编译的文章,该文章为<烂泥:mysql5.0数据库源码编译安装>.但是MySQL自5.5版本以后,就开始使用cmake 编译工 ...

  5. mysql5.7 cmake源码编译安装

    mysql5.7 cmake源码编译安装, -----该文章的知识点是一个大牛总结的,我这里只是加工了一下,非原创文章. 搜狐开源镜像站:http://mirrors.sohu.com/ 网易开源镜像 ...

  6. Splunk安装和配置及源码编译安装SVN

    Splunk安装和配置 http://my.oschina.net/tuyang/blog/189159 http://my.oschina.net/longniao/blog/82766 http: ...

  7. php 7.0 编译安装mysql_源码编译安装php7.0.5

    源码编译安装php7.0.5 源码包下载地址 安装epel扩展yum源 [root@xuegod63 ~]# yum clean all [root@xuegod63 ~]# yum list 注:R ...

  8. linux7安装haproxy,Centos7 源码编译安装haproxy

    Centos7 源码编译安装haproxy 操作环境: 一台haproxy主机地址为:192.168.80.100 两台web服务器地址分别为:192.168.80.102 192.168.80.10 ...

  9. CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境

    什么是LNMP? LNMP(别名LEMP)是指由Linux, Nginx, MySQL/MariaDB, PHP/Perl/Python组合成的动态Web应用程序和服务器,它是一组Web应用程序的基础 ...

最新文章

  1. [转载]Linux 线程实现机制分析
  2. Qt读取ini配置文件
  3. 字符串基础类型拓宽的操作,转换成整数值
  4. syslog可能引起得问题_牙齿经常有问题?可能是这4个坏习惯引起的,要改正
  5. IT英语2-编程词汇编程英语词汇
  6. linux中create命令详解,linux中 pmap 命令详解
  7. C++_类和对象_封装_成员属性私有化---C++语言工作笔记038
  8. 使用ssl_exporter监控K8S集群证书
  9. 2017省夏令营Day7
  10. H.264的Slice及Slice类型
  11. 东北大学OJ-1216: 实验2-6 :计算圆椎体体积
  12. 面试智力题,1000瓶水,其中一瓶有毒,而且毒性无敌,稀释一亿倍毒性都不减,毒性的发作时间最长为1小时,请问怎样可以在两个小时之内找出哪瓶水有毒
  13. 网络工程师必知的几款网络故障排除工具
  14. vue3.0 ts版项目配置axios
  15. python打开qq并登录_使用Python进行QQ批量登录的实例代码
  16. VMWare 设置CentOS虚拟机固定IP地址
  17. web缓存—Squid代理服务
  18. 郑州机电工程学校计算机部,郑州机电工程学校2021年招生录取分数线
  19. 热释电传感器三个引脚_热释电传感器基本知识
  20. android安全检测工具,梆梆安全 - 防止反编译|APP安全加固|应用加固|盗版监测

热门文章

  1. 【驱动】GPIO寄存器配置总结
  2. mysql isnu_mysql和nginx服务是否正常监控脚本
  3. react登录页面_「开源」React-Admin终极后台管理项目解决方案
  4. miui通知栏要点两下_MIUI免费主题分享,半透明通知栏很好看,另附壁纸!
  5. 校园音乐点歌平台的设计与开发 微信小程序 推荐点歌 java 开发
  6. iOS 中 load 和 initialize的实现顺序
  7. Asp.Net MVC3 简单入门详解过滤器Filter
  8. 一个简单的slider滑块组件
  9. 零基础学习Python需要注意的几个点,Python培训机构排名
  10. java maven项目使用sonar审核代码