【转】Leach协议学习(1)——NS2.27+leach协议安装
2010-03-02 00:01
567 查看
转自:http://hi.baidu.com/jerry_916/blog/item/ab630c32391f944aac4b5f3e.html
1、 WinXP+Cygwin+NS2.27安装(略)
2、 Leach安装
(1)下载 http://www.internetworkflow.com/downloads/ns2leach/mit.tar.gz
(2) 安装
$ cd ns-allinone-2.27/ns-2.27
$ gunzip mit.tar.gz
$ tar -xvf mit.tar
$ vi Makefile
//添加-DMIT_uAMPS到DEFINE列表中; (第60行)
//添加-I./mit/rca -I./mit/uAMPS到INCLUDES列表中;(第71行)
// 将下列内容添加到gaf/gaf.o /这一行之前(第202行)
//mit/rca/energy.o mit/rca/rcagent.o /
//mit/rca/rca-ll.o mit/rca/resource.o /
//mac/mac-sensor-timers.o mac/mac-sensor.o mit/uAMPS/bsagent.o /
// -lintl /这一行去掉或注释掉(第76行)
$ make clean
$ make
$ vi test
//修改如下:
// #!/bin/bash
// cd tcl/ex
// ns wireless-demo-csci694.tcl
// sleep 2
// cd ../../
//./leach_test
$ vi leach_test
//在ns tcl/ex/wireless.tcl /前增加以下语句(第37行)
//RCA_LIBRARY=mit/rca
//export RCA_LIBRARY
//uAMPS_LIBRARY=mit/uAMPS
//export uAMPS_LIBRARY
$ cd
$ vi .bashrc
//在最后一行加入
//export RCA_LIBRARY=$home/Administrator/ns-allinone-2.27/ns-2.27/mit/rca
//export uAMPS_LIBRARY=$home/Administrator/ns-allinone-2.27/ns-2.27/mit/uAMPS
$ cd ns-allinone-2.27/ns-2.27
$ ./test
//显示结果
3、 安装时遇到的问题及解决方案
(1)make错误如下图
解决办法:
根据错误提示把wireless-phy.cc文件的第320行和321行的min改为MIN即可。
(2)make出现错误如下图
解决办法:
修改
D:/cygwin/home/Administrator/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec/my-endian.h文件
#ifndef _ENDIAN_H_
#define _ENDIAN_H_
改为
#ifndef _MY_ENDIAN_H_
#define _MY_ENDIAN_H_
或者将该文件的第一行和最后一行注释掉即可。
(3)./test出现warning如下:
D:/cygwin/home/Administrator/ns-allinone-2.27/ns-2.27/tcl/lib/ns_default.tcl文件第692行加入7个初始值如下:
Phy/WirelessPhy set alive_ 1
Phy/WirelessPhy set Efriss_amp_ 100 * 1e-12
Phy/WirelessPhy set Etwo_ray_amp_ 0.013 * 1e-12
Phy/WirelessPhy set EXcvr_ 50 * 1e-9
Phy/WirelessPhy set sleep_ 0
Phy/WirelessPhy set ss_ 1
Phy/WirelessPhy set dist_ 0
具体的初始值应该对照
D:/cygwin/home/Administrator/ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc输入
(第95行,第97-99行,第104-105行,第107行)
(4)测试脚本为tcl/ex/wireless.tcl,老提示couldn't read file "tcl/ lib/ ns-mobilenode.tcl":no such file or directory while executing "source.orig tcl/ lib/ ns-mobilenode.tcl"
解决办法:路径的问题,直接运行tcl/ex/目录下的wireless.tcl时 将source tcl/ lib/ ns-mobilenode.tcl改成source ../ lib/ ns-mobilenode.tcl, 但你是测试leach协议 应该从ns-x.xx目录下直接运行./leach_test,这时就不用改了
(5)Installation: A possible problem with CPP_NAMESPACE
1、 WinXP+Cygwin+NS2.27安装(略)
2、 Leach安装
(1)下载 http://www.internetworkflow.com/downloads/ns2leach/mit.tar.gz
(2) 安装
$ cd ns-allinone-2.27/ns-2.27
$ gunzip mit.tar.gz
$ tar -xvf mit.tar
$ vi Makefile
//添加-DMIT_uAMPS到DEFINE列表中; (第60行)
//添加-I./mit/rca -I./mit/uAMPS到INCLUDES列表中;(第71行)
// 将下列内容添加到gaf/gaf.o /这一行之前(第202行)
//mit/rca/energy.o mit/rca/rcagent.o /
//mit/rca/rca-ll.o mit/rca/resource.o /
//mac/mac-sensor-timers.o mac/mac-sensor.o mit/uAMPS/bsagent.o /
// -lintl /这一行去掉或注释掉(第76行)
$ make clean
$ make
$ vi test
//修改如下:
// #!/bin/bash
// cd tcl/ex
// ns wireless-demo-csci694.tcl
// sleep 2
// cd ../../
//./leach_test
$ vi leach_test
//在ns tcl/ex/wireless.tcl /前增加以下语句(第37行)
//RCA_LIBRARY=mit/rca
//export RCA_LIBRARY
//uAMPS_LIBRARY=mit/uAMPS
//export uAMPS_LIBRARY
$ cd
$ vi .bashrc
//在最后一行加入
//export RCA_LIBRARY=$home/Administrator/ns-allinone-2.27/ns-2.27/mit/rca
//export uAMPS_LIBRARY=$home/Administrator/ns-allinone-2.27/ns-2.27/mit/uAMPS
$ cd ns-allinone-2.27/ns-2.27
$ ./test
//显示结果
3、 安装时遇到的问题及解决方案
(1)make错误如下图
解决办法:
根据错误提示把wireless-phy.cc文件的第320行和321行的min改为MIN即可。
(2)make出现错误如下图
解决办法:
修改
D:/cygwin/home/Administrator/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec/my-endian.h文件
#ifndef _ENDIAN_H_
#define _ENDIAN_H_
改为
#ifndef _MY_ENDIAN_H_
#define _MY_ENDIAN_H_
或者将该文件的第一行和最后一行注释掉即可。
(3)./test出现warning如下:
D:/cygwin/home/Administrator/ns-allinone-2.27/ns-2.27/tcl/lib/ns_default.tcl文件第692行加入7个初始值如下:
Phy/WirelessPhy set alive_ 1
Phy/WirelessPhy set Efriss_amp_ 100 * 1e-12
Phy/WirelessPhy set Etwo_ray_amp_ 0.013 * 1e-12
Phy/WirelessPhy set EXcvr_ 50 * 1e-9
Phy/WirelessPhy set sleep_ 0
Phy/WirelessPhy set ss_ 1
Phy/WirelessPhy set dist_ 0
具体的初始值应该对照
D:/cygwin/home/Administrator/ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc输入
(第95行,第97-99行,第104-105行,第107行)
(4)测试脚本为tcl/ex/wireless.tcl,老提示couldn't read file "tcl/ lib/ ns-mobilenode.tcl":no such file or directory while executing "source.orig tcl/ lib/ ns-mobilenode.tcl"
解决办法:路径的问题,直接运行tcl/ex/目录下的wireless.tcl时 将source tcl/ lib/ ns-mobilenode.tcl改成source ../ lib/ ns-mobilenode.tcl, 但你是测试leach协议 应该从ns-x.xx目录下直接运行./leach_test,这时就不用改了
(5)Installation: A possible problem with CPP_NAMESPACE
ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile, ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile, and ns-2.27/indep-utils/webtrace-conv/dec/Makefile, needed to be modified in order to fix a bug in ISI's distribution. The bug caused a compile-time error that looked like this: g++ -c -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -o setdest.o setdest.cc In file included from ../../../config.h:54, from setdest.h:5, from setdest.cc:57: ../../../autoconf.h:85: Error: namespace `CPP_NAMESPACE' undeclared setdest.cc:71:1: warning: "INFINITY" redefined In file included from /usr/include/math.h:40, from setdest.cc:43: /usr/include/bits/mathdef.h:35:1: warning: this is the location of the previous definition make[1]: *** [setdest.o] Error 1 make[1]: Leaving directory `/home/iandow/netsim/ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest' make[1]: Entering directory `/home/iandow/netsim/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec' To fix the bug, edit ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile and change this line: DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ to this line: DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=std In the other two makefiles, append -DCPP_NAMESPACE=std to CFLAGS. I discovered that fix by searching the NS news database[2] for "CPP_NAMESPACE".
相关文章推荐
- 【转】Leach协议学习(1)——NS2.27+leach协议安装
- NS2.27平台安装leach协议
- NS2.27上安装和分析leach协议
- 收藏 Leach协议学习(3)——Leach协议分析
- 菜鸟学习网络协议软件Quagga,修改ospfd vty端口和编译安装
- leach协议在NS2.34上的安装移植
- Ubuntu10.04中的Leach协议一键安装
- MQTT学习笔记——MQTT协议体验 Mosquitto安装和使用
- MQTT协议学习研究 & Mosquitto简要教程(安装和使用)
- leach协议在NS2.33上的安装
- 【转】Leach协议学习(4)——Leach协议改进
- 安装Leach协议的步骤
- 【转载】MQTT学习笔记——MQTT协议体验 Mosquitto安装和使用
- 【转】Leach协议学习(2)——简单仿真测试
- leach协议在NS 2.34上的安装(半转半改)
- 【转】Leach协议学习(2)——简单仿真测试
- Leach协议学习(4)——Leach协议改进
- 马哥学习笔记二十五——ISCSI协议,架构及其安装配置
- MQTT学习笔记——MQTT协议体验 Mosquitto安装和使用
- 【转】Leach协议学习(3)——Leach协议分析