Ubuntu下安装 NS2的问题记录

记录一下在Ubuntu下安装NS2时候遇到的问题。原本想在win下通过cygwin装的,奈何装了一天的cygwin,也没把东西装全,罢了,直接在Ubuntu吧。下面是我遇到的问题,更多问题请直接前往官方的trouble shooting页面

1、make: *** [tk3d.o] 错误 1

tk8.5.10 make failed! Exiting ...

安装libx11-dev可以解决问题,命令行:

sudo apt-get install libx11-dev

2、can’t find X includes

otcl-1.14 configuration failed! Exiting ...

安装libXt-dev可以解决问题,命令行:

sudo apt-get install libXt-dev

3、安装完成后

Please put /home/tang/Downloads/ns-allinone-2.35/bin:/home/tang/Downloads/ns-allinone-2.35/tcl8.5.10/unix:/home/tang/Downloads/ns-allinone-2.35/tk8.5.10/unix
 into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /home/tang/Downloads/ns-allinone-2.35/otcl-1.14, /home/tang/Downloads/ns-allinone-2.35/lib,
 into your LD_LIBRARY_PATH environment variable.
 If it complains about X libraries, add path to your X libraries
 into LD_LIBRARY_PATH.
 If you are using csh, you can set it like:
 setenv LD_LIBRARY_PATH <paths>
 If you are using sh, you can set it like:
 export LD_LIBRARY_PATH=<paths>
(2) You MUST put /home/tang/Downloads/ns-allinone-2.35/tcl8.5.10/library into your TCL_LIBRARY environmental
 variable. Otherwise ns/nam will complain during startup.
After these steps, you can now run the ns validation suite with
 cd ns-2.35; ./validate
For trouble shooting, please first read ns problems page
 http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
 for related posts.

这时候需要添加路径,方法:

 

/home/user(自己的用户名,若为root用户则在/root)下编辑 .bashrc

export NS_HOME=/home/chenkai/ns/(路径自行修改,下同)ns-allinone-2.35
export PATH=$NS_HOME/nam-1.15:$NS_HOME/tcl8.5.10/unix:$NS_HOME/tk8.5.10/unix:$NS_HOME/bin:$PATH
export LD_LIBRARY_PATH=$NS_HOME/tcl8.5.10/unix:$NS_HOME/tk8.5.10/unix:$NS_HOME/otcl-1.14:$NS_HOME/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=$NS_HOME/tcl8.5.10/library

输入source .bashrc  使环境变量有效。

以上来自http://blog.csdn.net/chenkai619/article/details/7633503

4、一切完成后,运行simple.tcl时候报错:

This probably means that tk wasn't installed properly.

解决方法:

在/root的.bashrc的最后加上:

export TCL_LIBRARY=/home/username/Desktop(路径自行修改)/ns-allinone-2.35/tcl8.5.10/library:/home/username/Desktop/ns-allinone-2.35/tk8.5.10/library

然后运行

source ~./bashrc" in terminal.

来自http://www.cnblogs.com/zhchngzng/p/3584651.html

5、测试是否安装成功

ns ./ns-allinone-2.35/ns-2.35/tcl/ex/simple.tcl

没问题就会出现界面了。

来自https://forum.ubuntu.org.cn/viewtopic.php?f=122&t=449640

同时感谢另外一些参考文章,给我提供了许多帮助:

http://www.cnblogs.com/liuxiaoke/p/3488616.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注