资源预览内容
第1页 / 共5页
第2页 / 共5页
第3页 / 共5页
第4页 / 共5页
第5页 / 共5页
亲,该文档总共5页全部预览完了,如果喜欢就下载吧!
资源描述
系统环境为 ubuntu11.041、首先下载 ns-allinone-2.33.tar.gz。http:/sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.33/2、更新了一下系统。在终端输入:sudo apt-get update #更新源列表sudo apt-get upgrade #更新已安装的包sudo apt-get dist-upgrade #更新软件,升级系统3、装几个需要使用的软件包sudo apt-get install build-essential #for gcc and some essentialsudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev #for tcl and tksudo apt-get install libxmu-dev libxmu-headers #for nam4、安装 NS2sudo tar -vxzf ns-allinone-2.33.tar.gz #解压到当前目录/home/bt/ns2/cd ns-allinone-2.33 #进入目录sudo ./install #开始安装然后命令行快速刷新,确实很养眼。但不一会突然报错:(以上省略)make: * libotcl.so 错误 1otcl-1.13 make failed! Exiting .See http:/www.isi.edu/nsnam/ns/ns-problems.html for problems卡住了,很郁闷,于是上网找解决方法。在2上得到结果如下:gcc 4.0 版本以前是用 ld -share 来生成共享库的,但是到了 4.0 以上的版本,这个命令改为了 gcc -share。在终端里输入 gcc -v 查看,我的版本是 gcc version 4.4.3。开始修改。cd /home/bt/ns2 /ns-allinone-2.33/otcl-1.13sudo gedit configure.in把 77 行的 SHLIB_LD=ld -shared,改为 SHLIB_LD=gcc -shared,保存退出。然后sudo gedit configure 按照2中的说法,在 5518 行, 把 SHLIB_LD=ld -shared改为 SHLIB_LD=gcc -shared,保存退出。cd 回到目录 ns-allinone-2.33 下,重新运行sudo ./install出现错误:tools/ranvar.cc: In member function virtual double GammaRandomVariable:value():tools/ranvar.cc:219:70: error: cannot call constructor GammaRandomVariable:GammaRandomVariable directlytools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant :GammaRandomVariablemake: * tools/ranvar.o错误 1Ns make failed!See http:/www.isi.edu/nsnam/ns/ns-problems.html for problems这是由于 gcc 版本提高后对类内部函数调用的简化造成的不兼容,解决方法如下:在 ns-allinone-2.33/ ns-2.33/tools 文件夹下,找到报错提示中的 ranvar.cc 文件,打开找到对应的 219 行删除:GaammaRandomVariable,保存,cd 回到目录 ns-allinone-2.33 下,重新运行sudo ./install出现同类问题时,如:mobile/nakagami.cc: In member function virtual double Nakagami:Pr(PacketStamp*, PacketStamp*, WirelessPhy*):mobile/nakagami.cc:183:73: error: cannot call constructor ErlangRandomVariable:ErlangRandomVariable directlymobile/nakagami.cc:183:73: error: for a function-style cast, remove the redundant :ErlangRandomVariablemobile/nakagami.cc:185:67: error: cannot call constructor GammaRandomVariable:GammaRandomVariable directlymobile/nakagami.cc:185:67: error: for a function-style cast, remove the redundant :GammaRandomVariablemake: * mobile/nakagami.o错误 1Ns make failed!See http:/www.isi.edu/nsnam/ns/ns-problems.html for problems解决方法:在 ns-allinone-2.33/ ns-2.33/ mobile 文件夹下,找到报错提示中的 nakagami.cc 文件,打开找到对应的 183 行删除:ErlangRandomVariable ,保存,cd 回到目录 ns-allinone-2.33 下,重新运行sudo ./install顺利完成安装。最后出来提示:Please put /home/bt/ns2/ns-allinone-2.33/bin:/home/bt/ns2/ns-allinone-2.33/tcl8.4.18/unix:/home/bt/ns2/ns-allinone-2.33/tk8.4.18/unixinto your PATH environment; so that youll be able to run itm/tclsh/wish/xgraph.IMPORTANT NOTICES:(1) You MUST put /home/bt/ns2/ns-allinone-2.33/otcl-1.13, /home/bt/ns2/ns-allinone-2.33/lib,into your LD_LIBRARY_PATH environment variable.If it complains about X libraries, add path to your X librariesinto LD_LIBRARY_PATH.If you are using csh, you can set it like:setenv LD_LIBRARY_PATH If you are using sh, you can set it like:export LD_LIBRARY_PATH=(2) You MUST put /home/bt/ns2/ns-allinone-2.33/tcl8.4.18/library into your TCL_LIBRARY environmentalvariable. Otherwise ns/nam will complain during startup.After these steps, you can now run the ns validation suite withcd ns-2.33; ./validateFor trouble shooting, please first read ns problems pagehttp:/www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archivefor related posts.5、配置环境变量用 cd 进入目录/home /bt ( bt 是我的用户名) ,然后sudo gedit .bashrc在文件末尾加入:PATH=$PATH: /home/bt/ns2 /ns-allinone-2.33/bin: /home/bt/ns2 /ns-allinone-2.33/tcl8.4.18/unix: /home/bt/ns2 /ns-allinone-2.33/tk8.4.18/unix LD_LIBRARY_PATH= /home/bt/ns2 /ns-allinone-2.33/otcl-1.13: /home/bt/ns2 /ns-allinone-2.33/libTCL_LIBRARY=$TCL_LIBRARY: /home/bt/ns2 /ns-allinone-2.33/tcl8.4.18/library保存退出(上述内容在安装结束后的提示中有,见粗体部分) 。6、验证打开一个新终端,输入 ns,如果出现%,则说明安装成功。也可以进入 /home/bt/ns2 /ns- allinone-2.33/ns-2.33/,输入./validate 验证。错误三:输入命令 ns 之后出现如下错误:* buffer overflow detected *: ns terminated= Backtrace: =/lib/i386-linux-gnu/libc.so.6(_fortify_fail+0x50)0x451df0/lib/i386-linux-gnu/libc.so.6(+0xe4cca)0x450cca/lib/i386-linux-gnu/libc.so.6(_strcpy_chk+0x3f)0x45005fns(TclTraceVariableObjCmd+0x420)0x83adb00ns(Tcl_TraceObjCmd+0x469)0x83b2989ns(TclEvalObjvInternal+0x37b)0x839f2bbns(Tcl_EvalEx+0x419)0x83a11a9ns(Tcl_Eval+0x3c)0x83a14ccns(Tcl_GlobalEval+0x36)0x83a2086ns(_ZN3Tcl4evalEPc+0x1b)0x839438bns(_ZN3Tcl5evalcEPKc+0xb3)0x839435dns(_ZN11EmbeddedTcl4loadEv+0x1d)0x83952cfns(Tcl_AppInit+0xb5)0x83940abns(Tcl_Main+0x285)0x83eb0c5ns(nslibmain+0x20)0x8393fd4ns(main+0x1b)0x8394147/lib/i386-linux-gnu/libc.so.6(_libc_start_main+0xe7)0x382e37ns0x81a8481= Memory map: =00c38000-00c54000 r-xp 00000000 08:01 19439 /lib/i386-linux-gnu/ld-2.13.so00c54000-00c55000 r-p 0001b000 08:01 19439 /lib
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号