本文小编为大家详细介绍“ubuntu怎么编译安装mono环境”,内容详细,步骤清晰,细节处理妥当,希望这篇“ubuntu怎么编译安装mono环境”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。
准备工作
一个全新安装的ubuntu13.10系统
下载mono源代码并编译
nike@nike-pc:~$ ls desktop downloads music public videos documents examples.desktop pictures templates nike@nike-pc:~$ mkdir src nike@nike-pc:~$ cd src nike@nike-pc:~/src$ wget http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2 --2014-03-27 21:24:30-- http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2 resolving download.mono-project.com (download.mono-project.com)... 54.240.168.102, 54.230.156.158, 54.230.157.116, ... connecting to download.mono-project.com (download.mono-project.com)|54.240.168.102|:80... connected. http request sent, awaiting response... 200 ok length: 77515552 (74m) [application/x-bzip2] saving to: ‘mono-3.2.8.tar.bz2' 100%[======================================>] 77,515,552 189k/s in 10m 50s nike@nike-pc:~/src$ ls mono-3.2.8.tar.bz2 nike@nike-pc:~/src$ tar -xjf mono-3.2.8.tar.bz2 nike@nike-pc:~/src$ cd mono-3.2.8/ nike@nike-pc:~/src/mono-3.2.8$ ./configure --prefix=/opt/mono-3.2.8 checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu 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... no checking for mawk... mawk 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 whether ln -s works... yes checking whether make supports nested variables... yes checking host platform characteristics... ok checking for gcc... gcc checking for gcc... (cached) gcc checking whether the c compiler works... yes checking for c compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the gnu c compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept iso c89... none needed checking for style of include used by make... gnu checking dependency style of gcc... gcc3 checking for g++... no checking whether we are using the gnu c++ compiler... no checking whether g++ accepts -g... no checking dependency style of g++... none checking dependency style of gcc... gcc3 checking for gawk... (cached) mawk checking whether gcc and cc understand -c and -o together... yes configure: error: you need to install g++
因为没有安装g++而无法继续:
nike@nike-pc:~/src/mono-3.2.8$ sudo apt-get install g++ [sudo] password for nike: reading package lists... done building dependency tree reading state information... done the following extra packages will be installed: cpp-4.8 g++-4.8 gcc-4.8 gcc-4.8-base libasan0 libatomic1 libgcc-4.8-dev libgcc1 libgomp1 libitm1 libquadmath0 libstdc++-4.8-dev libstdc++6 suggested packages: gcc-4.8-locales g++-multilib g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg gcc-4.8-multilib libmudflap0-4.8-dev libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg libbacktrace1-dbg libquadmath0-dbg libmudflap0-dbg libstdc++-4.8-doc the following new packages will be installed: g++ g++-4.8 libstdc++-4.8-dev the following packages will be upgraded: cpp-4.8 gcc-4.8 gcc-4.8-base libasan0 libatomic1 libgcc-4.8-dev libgcc1 libgomp1 libitm1 libquadmath0 libstdc++6 11 upgraded, 3 newly installed, 0 to remove and 275 not upgraded. need to get 25.9 mb of archives. after this operation, 28.2 mb of additional disk space will be used. do you want to continue [y/n]? ==============>省略了很多<==============
重新初始化mono安装配置文件:
nike@nike-pc:~/src/mono-3.2.8$ ./configure --prefix=/opt/mono-3.2.8 ==============>省略了很多<============== engine: gc: sgen and bundled boehm gc with typed gc and parallel mark tls: __thread sigaltstack: yes engine: building and using the jit oprofile: no bigarrays: no dtrace: no llvm back end: no (dynamically loaded: no) libraries: .net 2.0/3.5: yes .net 4.0: yes .net 4.5: yes monodroid: no monotouch: no jni support: ikvm native libgdiplus: assumed to be installed zlib: nike@nike-pc:~/src/mono-3.2.8$
./configure通过。
编译mono源代码
nike@nike-pc:~/src/mono-3.2.8$ make ==============>漫长的编译~<============== nike@nike-pc:~/src/mono-3.2.8$ sudo make install ==============>省略了很多<==============
安装成功。
设置path环境变量
nike@nike-pc:~/src/mono-3.2.8$ cd ~ nike@nike-pc:~$ vim .bashrc
在该文件末尾追加以下语句:
if [ -d /opt/mono-3.2.8/bin ]; then export path=/opt/mono-3.2.8/bin:$path fi
然后:
nike@nike-pc:~$ . .bashrc nike@nike-pc:~$ echo $path /opt/mono-3.2.8/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games nike@nike-pc:~$
验证mono是否安装正确
nike@nike-pc:~$ mono --version mono jit compiler version 3.2.8 (tarball 2014年 03月 27日 星期四 21:55:30 cst) copyright (c) 2002-2014 novell, inc, xamarin inc and contributors. www.mono-project.com tls: __thread sigsegv: altstack notifications: epoll architecture: x86 disabled: none misc: softdebug llvm: supported, not enabled. gc: sgen nike@nike-pc:~$ dmcs --version mono c# compiler version 3.2.8.0 nike@nike-pc:~$
安装成功。
读到这里,这篇“ubuntu怎么编译安装mono环境”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。