今天终于把NS-2在slackware上安装成功了,把安装笔记记录一下。
首先下载ns-2的软件包:ns-allinone-2.34.tar.gz
将软件包转移到/opt目录下,如果下载到/home/tiger506下面
进入/opt目录,对软件包进行解压
进入解压后的目录
安装软件包
回车之后进行安装,会提示error现象
tools/ranvar.cc: in member function `virtual double gammarandomvariable::value()’:
tools/ranvar.cc:219:70: error: cannot call constructor `GammaRandomVariable::GammaRandomVariable’
tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant
`::GaammaRandomVariable’
make: *** [tools/ranvar.o] Error 1
ns make failed
解决方法,vi 进入ranvar.cc
修改第219行,结果如下
保存后再次执行install文件,如果出现error,按照上面的方法进行修改。直至成功。
最后按照一下提示修改环境变量及设置变量。slackware修改变量,进入vi /etc/profile
Please put /opt/ns-allinone-2.34/bin:/opt/ns-allinone-2.34/tcl8.4.18/unix:/opt/ns-allinone-2.34/tk8.4.18/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /opt/ns-allinone-2.34/otcl-1.13, /opt/ns-allinone-2.34/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 /opt/ns-allinone-2.34/tcl8.4.18/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.34; ./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.
修改完以后执行
然后执行ns
执行nam
安装完成,可以开始ns的探索了