ubuntu13.10编译安装mono环境(一)
准备工作
一个全新安装的ubuntu13.10系统
下载Mono源代码并编译
nike@NIKE-PC:~$ls DesktopDownloadsMusicPublicVideos Documentsexamples.desktopPicturesTemplates nike@NIKE-PC:~$mkdirsrc nike@NIKE-PC:~$cdsrc nike@NIKE-PC:~/src$wgethttp://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2 --2014-03-2721:24:30--http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2 Resolvingdownload.mono-project.com(download.mono-project.com)...54.240.168.102,54.230.156.158,54.230.157.116,... Connectingtodownload.mono-project.com(download.mono-project.com)|54.240.168.102|:80...connected. HTTPrequestsent,awaitingresponse...200OK Length:77515552(74M)[application/x-bzip2] Savingto:‘mono-3.2.8.tar.bz2' 100%[======================================>]77,515,552189K/sin10m50s nike@NIKE-PC:~/src$ls mono-3.2.8.tar.bz2 nike@NIKE-PC:~/src$tar-xjfmono-3.2.8.tar.bz2 nike@NIKE-PC:~/src$cdmono-3.2.8/ nike@NIKE-PC:~/src/mono-3.2.8$./configure--prefix=/opt/mono-3.2.8 checkingbuildsystemtype...i686-pc-linux-gnu checkinghostsystemtype...i686-pc-linux-gnu checkingtargetsystemtype...i686-pc-linux-gnu checkingforaBSD-compatibleinstall.../usr/bin/install-c checkingwhetherbuildenvironmentissane...yes checkingforathread-safemkdir-p.../bin/mkdir-p checkingforgawk...no checkingformawk...mawk checkingwhethermakesets$(MAKE)...yes checkinghowtocreateaustartararchive...gnutar checkingwhethertoenablemaintainer-specificportionsofMakefiles...no checkingwhetherln-sworks...yes checkingwhethermakesupportsnestedvariables...yes checkinghostplatformcharacteristics...ok checkingforgcc...gcc checkingforgcc...(cached)gcc checkingwhethertheCcompilerworks...yes checkingforCcompilerdefaultoutputfilename...a.out checkingforsuffixofexecutables... checkingwhetherwearecrosscompiling...no checkingforsuffixofobjectfiles...o checkingwhetherweareusingtheGNUCcompiler...yes checkingwhethergccaccepts-g...yes checkingforgccoptiontoacceptISOC89...noneneeded checkingforstyleofincludeusedbymake...GNU checkingdependencystyleofgcc...gcc3 checkingforg++...no checkingwhetherweareusingtheGNUC++compiler...no checkingwhetherg++accepts-g...no checkingdependencystyleofg++...none checkingdependencystyleofgcc...gcc3 checkingforgawk...(cached)mawk checkingwhethergccandccunderstand-cand-otogether...yes configure:error:Youneedtoinstallg++
因为没有安装g++而无法继续:
nike@NIKE-PC:~/src/mono-3.2.8$sudoapt-getinstallg++ [sudo]passwordfornike: Readingpackagelists...Done Buildingdependencytree Readingstateinformation...Done Thefollowingextrapackageswillbeinstalled: cpp-4.8g++-4.8gcc-4.8gcc-4.8-baselibasan0libatomic1libgcc-4.8-dev libgcc1libgomp1libitm1libquadmath0libstdc++-4.8-devlibstdc++6 Suggestedpackages: gcc-4.8-localesg++-multilibg++-4.8-multilibgcc-4.8-doclibstdc++6-4.8-dbg gcc-4.8-multiliblibmudflap0-4.8-devlibgcc1-dbglibgomp1-dbglibitm1-dbg libatomic1-dbglibasan0-dbglibtsan0-dbglibbacktrace1-dbglibquadmath0-dbg libmudflap0-dbglibstdc++-4.8-doc ThefollowingNEWpackageswillbeinstalled: g++g++-4.8libstdc++-4.8-dev Thefollowingpackageswillbeupgraded: cpp-4.8gcc-4.8gcc-4.8-baselibasan0libatomic1libgcc-4.8-devlibgcc1 libgomp1libitm1libquadmath0libstdc++6 11upgraded,3newlyinstalled,0toremoveand275notupgraded. Needtoget25.9MBofarchives. Afterthisoperation,28.2MBofadditionaldiskspacewillbeused. Doyouwanttocontinue[Y/n]? ==============>省略了很多<==============
重新初始化mono安装配置文件:
nike@NIKE-PC:~/src/mono-3.2.8$./configure--prefix=/opt/mono-3.2.8 ==============>省略了很多<============== Engine: GC:sgenandbundledBoehmGCwithtypedGCandparallelmark TLS:__thread SIGALTSTACK:yes Engine:BuildingandusingtheJIT oprofile:no BigArrays:no DTrace:no LLVMBackEnd:no(dynamicallyloaded:no) Libraries: .NET2.0/3.5:yes .NET4.0:yes .NET4.5:yes MonoDroid:no MonoTouch:no JNIsupport:IKVMNative libgdiplus:assumedtobeinstalled 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$sudomakeinstall ==============>省略了很多<==============
安装成功。
设置PATH环境变量
nike@NIKE-PC:~/src/mono-3.2.8$cd~ nike@NIKE-PC:~$vim.bashrc
在该文件末尾追加以下语句:
if[-d/opt/mono-3.2.8/bin];then exportPATH=/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 MonoJITcompilerversion3.2.8(tarball2014年03月27日星期四21:55:30CST) Copyright(C)2002-2014Novell,Inc,XamarinIncandContributors.www.mono-project.com TLS:__thread SIGSEGV:altstack Notifications:epoll Architecture:x86 Disabled:none Misc:softdebug LLVM:supported,notenabled. GC:sgen nike@NIKE-PC:~$dmcs--version MonoC#compilerversion3.2.8.0 nike@NIKE-PC:~$
安装成功。