安装包是ns-allinone-2.28.tar.gz。Ubuntu7.10内核是2.6.22-14.
首先sudo apt-get update
sudo apt-get install build-essential 这是更新ubuntu
sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev 这是为安装NS做准备
sudo apt-get install libxmu-dev libxmu-headers 安装nam做准备
解压缩后,
输入:cd ns-allinone-2.28
输入:ls -a
回车后就可以看到一个名字为install的文件.
然后在终端中输入:./install
OK,NS开始安装了
然后waiting……
出现问题及解决方法
问题1
checking system version (for dynamic loading)... ./configure: 1: Syntax error: Unterminated quoted string
tcl8.3.2 configuration failed! Exiting ...
Tcl is not part of the ns project. Please see www.Scriptics.com
to see if they have a fix for your platform.
解决方法
分别进入以下目录:tcl8.x.x/unix/tcl.m4.
tk8.x.x/unix/tcl.m4.
otcl-1.x/configure.in.
将这些文件里的system=MP-RAS-`awk ' { print $3 } '/tc/.relid'` 改为:
system=MP-RAS-`awk ' { print $3 } '/etc/.relid`
然后再在这三个目录下运行命令autoconf.每个目录下运行两次~
问题2
继续输入 ./install
./sctp/sctp.h:630: error: extra qualification ‘SctpAgent::’on member ‘DumpSendBuffer’ make: *** [trace/trace.o] Error 1
Ns make failed!
解决办法
将文件sctp.h里面第630行DumpSendBuffer函数前面的'SctpAgent::'去掉。
问题3
继续输入 ./install
./mobile/god.h:88: error: extra qualification ‘vector::’ on member ‘operator=’
./mobile/god.h:93: error: extra qualification ‘vector::’ on member ‘operator+=’
./mobile/god.h:98: error: extra qualification ‘vector::’ on member ‘operator==
./mobile/god.h:101: error: extra qualification ‘vector::’ on member ‘operator!=’
make: *** [src_rtg/sragent.o] Error 1
Ns make failed!
解决办法:
分别将这些文件里面的‘vector::'去掉。
问题 4
queue/cbq.cc:112: error: ISO C++ forbids declaration of ‘CBQueue’ with no type
queue/cbq.cc:112: error: expected ‘;’ before ‘*’ token
queue/cbq.cc: In member function ‘virtual int CBQueue::insert_class(CBQClass*)’:
queue/cbq.cc:488: error: ‘class CBQClass’ has no member named ‘cbq_’
queue/cbq.cc: In constructor ‘CBQClass::CBQClass()’:
queue/cbq.cc:805: error: class ‘CBQClass’ does not have any field named ‘cbq_’
queue/cbq.cc: In member function ‘virtual void CBQClass::recv(Packet*, Handler*)’:
queue/cbq.cc:850: error: ‘cbq_’ was not declared in this scope
queue/cbq.cc:856: error: ‘cbq_’ was not declared in this scope
queue/cbq.cc: In member function ‘void CBQClass::update(Packet*, double)’:
queue/cbq.cc:873: error: ‘cbq_’ was not declared in this scope
queue/cbq.cc: In member function ‘int CBQClass::desc_with_demand()’:
queue/cbq.cc:928: error: ‘cbq_’ was not declared in this scope
queue/cbq.cc: In member function ‘void CBQClass::newallot(double)’:
queue/cbq.cc:975: error: ‘cbq_’ was not declared in this scope
queue/cbq.cc: In member function ‘virtual int CBQClass::command(int, const char* const*)’:
queue/cbq.cc:1002: error: ‘cbq_’ was not declared in this scope
make: *** [queue/cbq.o] Error 1
Ns make failed!
解决办法
用补丁——
补丁的用法即找到相应文件后,找到相应的程序段,行列数为@@ ...... @@之间数字,手动把补丁程序段中前面带有“+”号的行添加到文件中,而将前面带有“-”号的行在文件中删除,这是很花费时间的一件事,要有耐心~~
(网上很多类似的补丁,但很少类似的补丁用法说明。我自己在这里也浪费了很多时间,后来慢慢摸索出来的,为了看明白还去找了些patch的说明来看,后来还是一个同学说的好,patch为后缀的补丁包其实是注明了在哪个文件中的什么地方添加什么程序段,减少什么程序段)
用如下补丁
--- cbq.cc.old 2006-08-31 11:42:09.000000000 -0300
+++ cbq.cc 2006-08-31 11:43:31.000000000 -0300
@@ -87,6 +87,8 @@
#define LEAF_LEVEL 1 /* level# for leaves *
#define POWEROFTWO 16
+class CBQueue;
+
class CBQClass : public Connector {
public:
friend class CBQueue;
问题5
./tora/tora_neighbor.h:72: error: ISO C++ forbids declaration of ‘toraAgent’ with no type
./tora/tora_neighbor.h:72: error: expected ‘;’ before ‘*’ token
make: *** [tora/tora.o] Error 1
Ns make failed!
解决办法:
用如下补丁——
--- tora_neighbor.h.old 2006-08-31 11:57:34.000000000 -0300
+++ tora_neighbor.h 2006-08-31 11:58:11.000000000 -0300
@@ -41,6 +41,8 @@
#ifndef __tora_neighbor_h__
#define __tora_neighbor_h__
+class toraAgent;
+
enum LinkStatus {
LINK_UP = 0x0001, // upstream
LINK_DN = 0x0002, // downstream
问题6
dsr/dsragent.cc: In member function ‘void DSRAgent::handleFlowForwarding(SRPacket&, int)’:
dsr/dsragent.cc:804: error: ‘XmitFlowFailureCallback’ was not declared in this scope
dsr/dsragent.cc: In member function ‘void DSRAgent::sendOutPacketWithRoute(SRPacket&, bool, Time)’:
dsr/dsragent.cc:1361: error: ‘XmitFailureCallback’ was not declared in this scope
dsr/dsragent.cc:1362: error: ‘XmitFlowFailureCallback’ was not declared in this scope
dsr/dsragent.cc:1379: error: ‘XmitFailureCallback’ was not declared in this scope
make: *** [dsr/dsragent.o] Error 1
Ns make failed!
解决办法
打开 dsr/dsragent.cc 搜索XmitFlowFailureCallback和XmitFailureCallback,发现除了828、1385、1386、1403行之外,在文件后面还有这两个函数声明,把这两个函数声明移到文件前面