dopost 发表于 2018-5-9 10:36:12

悲惨的安装过程——redhat7安装ns2.33

  本次安装分为两大部分:
解决依赖性和更改配置文件
  一、解决依赖性
安装

# yum install gcc-c++ -y

  问题1

make: ***
  解决

# yum install libX11-devel -y

  问题2

can't find X includes
otcl-1.13 configuration failed! Exiting ...
  解决

# 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: *** Error 1

  解决

vim ns-2.33/mac/mac-802_11Ext.h,添加
#include <cstddef>
  问题5

make: *** 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: *** Error 1
  解决

vim ns-2.33/linkstate/ls.h
137         void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
  终于安装成功!!!!
快让我插会儿腰!!!!!
http://blog.51cto.com/12059878/<br/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 却有点问题

# ns
% nam
wrong # args: should be "namespace subcommand ?arg ...?"
%
  需要安装一下nam

# cd /root/Desktop/ns2/ns-allinone-2.33/nam-1.13
# ./configure
# make
然后会发现出现了nam文件
# ls nam
nam
# cp nam ../bin
  之后运行测试脚本,发现还是有以下错误

# pwd
/root/Desktop/ns2/ns-allinone-2.33/ns-2.33/tcl/ex
#
# ns simple.tcl

: no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll units
}"
invoked from within
"if { eq "classic" || eq "aqua"} {
bind Listbox <MouseWheel> {
%W yview scroll units
}
bind Li..."

  解决方法
在配置文件的588行,如下添加(这是早期ns bug所致)

# 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,
之后再重新编译和拷贝新的二进制。
# ./install
# cp nam ../bin
  激动人心,nam终于好了!!!

  最后安装xgraph

#cd /root/Desktop/ns2/ns-allinone-2.33/xgraph-12.1
# ./configure
# 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
页: [1]
查看完整版本: 悲惨的安装过程——redhat7安装ns2.33