如何在ubuntu10.04环境下安装ns-2.29+mih

来源:互联网 发布:法兰克编程入门 编辑:程序博客网 时间:2024/05/17 22:38

晤..每次都要摸索好久,还是记下来吧~~

NS2的这个MIH包包含的内容比较丰富,具体的内容参照以下两个网址:

http://www.nist.gov/itl/antd/emntg/ssm_seamlessandsecure.cfm

http://www.nist.gov/itl/antd/emntg/ssm_tools.cfm

下面开始安装

我的安装环境:

系统:Ubuntu10.04 LTS

GCC和G++版本:4.3.4


一、首先下载ns-allinone-2.29.tar.gz文件放到主目录下(我的是/home/wuxuguang)下,解压

tar -xvzf ns-allinone-2.29.tar.gz

     然后将我之前安装ns-2.29+mih成功的ns-2.29文件夹复制到ns-allinone-2.29目录下覆盖解压出来的ns-2.29文件夹

二、进入到ns-allinone-2.29目录下执行./install命令

helloworld@ubuntu:~$ cd ns-allinone-2.29/helloworld@ubuntu:~/ns-allinone-2.29$ ./install 

晤...报错:

============================================================
* Build tcl8.4.11
============================================================
loading cache ./config.cache
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for building with threads... no (default)
checking if the compiler understands -pipe... yes
checking how to run the C preprocessor... gcc -pipe -E
checking for sin... no
checking for main in -lieee... yes
checking for main in -linet... no
checking for net/errno.h... no
checking for connect... yes
checking for gethostbyname... yes
checking how to build libraries... static
checking for ranlib... ranlib
checking if 64bit support is requested... no
checking if 64bit Sparc VIS support is requested... no
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.4.11的过程中出错,百度一下,需要改以下几个地方:

helloworld@ubuntu:~/ns-allinone-2.29$ gedit tcl8.4.11/unix/configure tcl8.4.11/unix/tcl.m4
helloworld@ubuntu:~/ns-allinone-2.29$ gedit tk8.4.11/unix/configure tk8.4.11/unix/tcl.m

把以上文件中的.relid'`替换成.relid`,然后重新执行./install然后就会发现tcl8.4.11和tk8.4.11编译安装成功。


三、结果还是报错..NS安装成功,nam安装不成功

parser.h:97: error: extra qualification ‘ParseTable::’ on member ‘nam4wpan’parser.h:98: error: extra qualification ‘ParseTable::’ on member ‘wpan_bradius’In file included from netview.cc:51:node.h:226: error: extra qualification ‘Node::’ on member ‘getTclScriptLabel’node.h: In member function ‘virtual char* BoxNode::style()’:node.h:280: warning: deprecated conversion from string constant to ‘char*’node.h: In member function ‘virtual char* CircleNode::style()’:node.h:291: warning: deprecated conversion from string constant to ‘char*’node.h: In member function ‘virtual char* HexagonNode::style()’:node.h:302: warning: deprecated conversion from string constant to ‘char*’node.h: In member function ‘virtual char* VirtualNode::style()’:node.h:318: warning: deprecated conversion from string constant to ‘char*’make: *** [netview.o] 错误 1Nam make failed! Continue ...
找到文件/home/helloworld/ns-allinone-2.29/nam-1.11/parser.h的第97行和第98行去掉ParseTable::

对于其他文件(/home/helloworld/ns-allinone-2.29/nam-1.11/node.h,/home/helloworld/ns-allinone-2.29/nam-1.11/netgraph.h)也是如此

而对于/home/helloworld/ns-allinone-2.29/nam-1.11/agent.h,则需要将第73行的NULL改成0

这些改完之后,nam就能够安装成功了


四、运行几个脚本试试

helloworld@ubuntu:~/ns-allinone-2.29$ ns ns-2.29/tcl/hsntg/multiFace1.tc

晤..弹出一堆调试信息...成功...