|
本次安装分为两大部分:
解决依赖性和更改配置文件
一、解决依赖性
安装
[root@vm4 ns2]# yum install gcc-c++ -y
问题1
make: *** [tk3d.o]
解决
[root@vm4 ns2]# yum install libX11-devel -y
问题2
can't find X includes
otcl-1.13 configuration failed! Exiting ...
解决
[root@vm4 ns2]# yum install libXt-devel -y
二、更改文件
问题3
解决
vim ns-2.33/tools/ranvar.cc,改为如下
219 return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
问题4
make: *** [mac/mac-802_11Ext.o] Error 1
解决
vim ns-2.33/mac/mac-802_11Ext.h,添加
#include <cstddef>
问题5
make: *** [mobile/nakagami.o] Error 1
解决
vim ns-2.33/mobile/nakagami.cc 改为如下
183 resultPower = ErlangRandomVariable(Pr/m, int_m).value();
185 resultPower = GammaRandomVariable(m, Pr/m).value();
问题6
linkstate/ls.h:137:58: note: declarations in dependent base ‘std::map<int, LsIdSeq, std::less<int>, std::allocator<std::pair<const int, LsIdSeq> > >’ are not found by unqualified lookup
linkstate/ls.h:137:58: note: use ‘this->erase’ instead
make: *** [linkstate/ls.o] Error 1
解决
vim ns-2.33/linkstate/ls.h
137 void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
终于安装成功!!!!
快让我插会儿腰!!!!!
http://i2.51cto.com/images/blog/201801/06/5d37021e6ffa68e3d126304b1b303caa.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=" alt="悲惨的安装过程——redhat7安装ns2.33" />
下面是根据提示信息配置环境变量
(/root/Desktop/ns2/ 是我安装的路径,你要把他改成你的路径)
vim ./bashrc
PATH="$PATH:/root/Desktop/ns2/ns-allinone-2.33/bin:/root/Desktop/ns2/ns-allinone-2.33/tcl8.4.18/unix:/root/Desktop/ns2/ns-allinone-2.33/tk8.4.18/unix"
LD_LIBRARY_PATH="/root/Desktop/ns2/ns-allinone-2.33/otcl-1.13:/root/Desktop/ns2/ns-allinone-2.33/lib"
TCL_LIBRARY="$TCL_LIBRARY:/root/Desktop/ns2/ns-allinone-2.33/tcl8.4.18/library"
重新进入一个终端,发现ns出现%,nam 却有点问题
[root@vm4 ~]# ns
% nam
wrong # args: should be "namespace subcommand ?arg ...?"
%
需要安装一下nam
[root@vm4 nam-1.13]# cd /root/Desktop/ns2/ns-allinone-2.33/nam-1.13
[root@vm4 nam-1.13]# ./configure
[root@vm4 nam-1.13]# make
然后会发现出现了nam文件
[root@vm4 nam-1.13]# ls nam
nam
[root@vm4 nam-1.13]# cp nam ../bin
之后运行测试脚本,发现还是有以下错误
[root@vm4 ex]# pwd
/root/Desktop/ns2/ns-allinone-2.33/ns-2.33/tcl/ex
[root@vm4 ex]#
[root@vm4 ex]# ns simple.tcl
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."
解决方法
在配置文件的588行,如下添加(这是早期ns bug所致)
[root@vm4 generic]# vim /root/Desktop/ns2/ns-allinone-2.33/tk8.4.18/generitkBind.c
588 /* MappingNotify */ 0,
589 #ifdef GenericEvent
590 /* GenericEvent */ 0,
591 #endif
592 /* VirtualEvent */ VIRTUAL,
之后再重新编译和拷贝新的二进制。
[root@vm4 ns-allinone-2.33]# ./install
[root@vm4 nam-1.13]# cp nam ../bin
激动人心,nam终于好了!!!
最后安装xgraph
[root@vm4 xgraph-12.1]#cd /root/Desktop/ns2/ns-allinone-2.33/xgraph-12.1
[root@vm4 xgraph-12.1]# ./configure
[root@vm4 xgraph-12.1]# make
出现错误
dialog.c:780:5: error: too few arguments to function ‘getline’
dialog.c:891:1: error: conflicting types for ‘getline’
解决:根据提示将780和891中getline改为newgetline
vim dialog.c
780 while (newgetline(&lineptr, line))
891 newgetline(tptr, lptr)
之后再来一遍编译三部曲。
啊!!! 撒花啊撒花
最后的最后,finally
|
|