首页 > 其他 > 详细

NS2安装记录

时间:2014-03-07 16:43:26      阅读:940      评论:0      收藏:0      [点我收藏+]

 

1, Get Started:
http://www.isi.edu/nsnam/ns/ns-build.html#allinone

Build by pieces: 手动编译需要按顺序下载编译以下软件包:
Tcl release 8.5.10 (required component)
Tk release 8.5.10 (required component)
Otcl release 1.14 (required component)
TclCL release 1.20 (required component)
Ns release 2.35 (required component)
Nam release 1.15 (optional component)
Xgraph version 12 (optional component)
CWeb version 3.4g (optional component)
SGB version 1.0 (?) (optional component, builds sgblib for all UNIX type platforms)
Gt-itm gt-itm and sgb2ns 1.1 (optional component)
Zlib version 1.2.3 (optional, but required should Nam be used)

2, download all in once: ns-allinonce-2.35.tar.gz

3, tar zxvf ns-allinonce-2.35.tar.gz;
./install

4, tk8.5.10安装出错。(tk最新版本是8.6.1。)

In file included from /home/chn/Desktop/ns-allinone-2.35/tk8.5.10/unix/../generic/tkInt.h:19,
from /home/chn/Desktop/ns-allinone-2.35/tk8.5.10/unix/../generic/tk3d.c:14:
/home/chn/Desktop/ns-allinone-2.35/tk8.5.10/unix/../generic/tk.h:76:23: error: X11/Xlib.h: No such file or directory

......


5, 网上查到:若在ubuntu上安装ns2要先装几个库文件:
(1)sudo apt-get install build-essential,这样可以安装gcc,make。
(2)安装tk,tcl
sudo apt-get install tcl8.4
sudo apt-get install tcl8.4-dev
sudo apt-get install tk8.4
sudo apt-get install tk8.4-dev
(3)sudo apt-get install libxmu-dev,是和nam有关的东西。


6, sudo apt-get install build-essential
再次尝试./install【相同的失败】

7, sudo apt-get install tk8.5
sudo apt-get install tk8.5-dev
再次尝试./install
【tk安装成功,otcl-1.14 configuration failed!】

8, 网上查到:can‘t find X includes

otcl-1.11 configuration failed Exiting ...

安装x-window-system-dev可以解决问题

另:

安装libXt-dev可以解决问题

sudo apt-get install libXt-dev
9, apt-cache search x11-dev
libghc6-x11-dev - Haskell X11 binding for GHC
libwx11-dev - library to manage xlib - devel
libgl1-mesa-swx11-dev - A free implementation of the OpenGL API -- development files
libx11-dev - X11 client-side library (development headers)
然后一一安装。(为什么要安装X11 dev?)
【安装NS2成功】

10, 安装出错时,实际上考官方的解决方法:http://www.isi.edu/nsnam/ns/ns-problems.html

11, 环境变量设置:
IMPORTANT NOTICES:

(1) You MUST put /home/chn/Desktop/ns-allinone-2.35/otcl-1.14, /home/chn/Desktop/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/chn/Desktop/ns-allinone-2.35/tcl8.5.10/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.

这些对于Ubuntu,还需要配置PATH变量。总的来说是这样的:

export NS_HOME=/home/chn/Desktop/ns-allinone-2.35

PATH="$PATH:$NS_HOME/bin:$NS_HOME/tcl8.5.10/unix:$NS_HOME/tk8.5.10/unix"

export LD_LIBRARY_PATH="$NS_HOME/otcl-1.14,$NS_HOME/lib"
export TCL_LIBRARY="$NS_HOME/tcl8.5.10/library"

把以上代码加到~/.bashrc中。使用命令source ~/.bashrc可以使上述环境变量立即生效。

After these steps, you can now run the ns validation suite with
cd ns-2.35; ./validate

 

进入漫长的validating process(漫长,据说1个小时?)

【END】

 

example

NS2的example在ns-2.35/tcl/ex/中。运行: ns <tcl filename>

NS2安装记录,布布扣,bubuko.com

NS2安装记录

原文:http://www.cnblogs.com/zhchngzng/p/3584651.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!