linuxs上mono

当前,在Linux系统上架设ASP.NET网站、建设WEB应用工程项目已经在国内流行起来,而“Mono+Jexus”架构模式是Linux承载ASP.NET企业级应用的极为重要的架构方式,这种架构中,Jexus很好安装、配置,基本上就是一个下载、解压、复制的过程,但是,用源码安装Mono就麻烦一些,特别是才从Windows转向Linux平台的技术人员,因为对Linux极为陌生,mono安装常常是他们遇到的主要的拦路虎。
下面,我介绍一下在Linux上用源码安装Mono的方法,希望能对初学者有点帮助。
首先是Linux发行版选用的问题,我建议大家选用Ubuntu服务器版,本技术资料也是基于Ubuntu 14.04 写的。
一、更新系统:
sudo apt-get update
sudo apt-get upgrade
二、构建编译环境:
如果你的系统是新安装的,那么你得构建一个编译环境,以便顺利完成对mono源文件的编译安装。
sudo apt-get install build-essential
sudo apt-get install automake autoconf
sudo apt-get install bison gettext libtool libglib2.0-dev libfreetype6-dev libfontconfig-dev
三、安装libgdiplus、mono以及编译环境所需要的其它库文件
sudo apt-get install libgif-dev libtiff4-dev libpng12-dev libexif-dev libx11-dev libxft-dev libjpeg62-dev(或libgpeg-dev)
四、源文件下载与解压:
1,下载:
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2
wget http://download.mono-project.com/sources/mono/mono-3.0.12.tar.bz2
2,解压:
tar jvxf libgdiplus-2.10.tar.bz2
tar jvxf mono-3.0.12.tar.bz2
五、安装Libgdiplus和Mono:
1、安装libgdiplus
  cd libgdiplus-2.10
  ./configure --prefix=/usr
  make
  sudo make install
  cd ..
2、安装Mono
  cd mono-3.0.12
  ./configure --prefix=/usr
  make
  sudo make install
  cd ..
通过以上的步骤,Mono就安装好了,可以通过 mono -V 查看mono版本的方式验证安装是否成功。

 

异常报错如下:

发现在该操作系统报错了:如下

复制代码
gdiplus-private.h:33:31: fatal error: freetype/tttables.h: No such file or directory
 #include <freetype/tttables.h>
                               ^
compilation terminated.
make[2]: *** [adjustablearrowcap.lo] Error 1
make[2]: Leaving directory `/root/libgdiplus-2.10/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/libgdiplus-2.10'
make: *** [all] Error 2
root@ubuntu:~/libgdiplus-2.10# sudo ln -s /usr/X11/include/freetype2/freetype/ /usr/X11/include/freetype
ln: failed to create symbolic link ‘/usr/X11/include/freetype’: No such file or directory
复制代码

这个错误就是说创建/usr/X11/include/freetype链接失败了,因为找不到freetype

我们打开/usr/include看有没有freetype这个目录,没有吧,但是我们找到了freetype2,这样我们做个链接吧

ln -s /usr/include/freetype2 /usr/include/freetype

然后继续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://beginor.github.io/2013/10/15/install-and-config-mono-on-ubuntu-server.html

先执行 ./configure 命令, 然后编辑libgdiplus-2.10.9目录下的 tests/Makefile 文件;
将 130 行的 LIBS = -lpthread -lfontconfig 改为 LIBS = -lpthread -lfontconfig -lglib-2.0 -lX11;
再次执行 make 命令即可。

 

posted @ 2016-05-06 11:05  zhangtianyu  阅读(265)  评论(0编辑  收藏  举报