ubuntu下NS2+leach算法安装笔记(1)
2013-07-09 15:07
232 查看
本人是新人,也在学习过程中。对LINUX,NS2这些都不是很熟悉,只是自己跌跌撞撞,参考了各方面资料总结出来的笔记。希望和大家一起学习,对大家有所帮助。不妥之处还望指正。
NS装得是ns-allinone-2.34,LEACH算法就是使用的MIT发布的包。以下是两个包的下载地址。
NS2:http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/
LEACH:http://www.baisi.net/viewthread.php?tid=10172&highlight=leach(PS:这个论坛有很多探讨,个人觉得不错,不是广告!!!)
下载完毕之后,首先是对ubuntu的更新
$sudo apt-get install build-essential
$sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev
$sudo apt-get install libxmu-dev libxmu-headers 这个主要是为了nam。就是那个图形化结果的东西。
理论上这些东西装了就好了,但是以防万一,可以把机子中其他部分也给update一下。
之后就是解压
$tar -xzf ns-allinone-2.34.tar.gz
完毕之后首先确定以下本机的gcc版本
$gcc -v
如果是大于4.0的
需要修改如下两个个地方
ns-allinone-2.34/otcl-1.13中, configure.in 的77行SHLIB_LD="ld -shared", 改为SHLIB_LD="gcc -shared"
ns-allinone-2.34/otcl-1.13中, configure 的6304行SHLIB_LD="ld -shared", 改为SHLIB_LD="gcc -shared"
注意,行数之针对2.34版本的ns2有效。
修改mac_802.11Ext.cc文件
在ns-2.34/mac/mac-802_11Ext.h 添加头文件引用 #include <cstddef>
完成之后,回到ns-allinone-2.34目录下,输入./install即可安装。
安装过程中可以出现以下几种错误:
(1)出现****::****()错误
tools/ranvar.cc: In member function ‘virtual double GammaRandomVariable::value()’:
tools/ranvar.cc:219:70: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly
tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’
make: *** [tools/ranvar.o]错误1
这个错误只需要进入ns-2.34/tools文件夹中对ranvar.cc文件的219行改一下就行,将::GammaRandomVariable删除即可。
后面还会有两个类似的错误,在ns-2.34/mobile/nakagami.cc文件中,183行和185行。
(2)这个问题我没复制下来,反正关键字是"erase" not declared之类的
这个需要打开相应的文件,然后找到相应的行数,在erase之前添加一个this->即可。
这个错误提示中会告诉你应该怎么改。
这些都OK了,那么NS应该会安装完毕。看到官网上所说的那个提示。
Please put /home/ns-allinone-2.33/bin:/home/ns-allinone-2.33/tcl8.4.18/unix:/home/Public/ns-allinone-2.33/tk8.4.18/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /home/ns-allinone-2.33/otcl-1.13, /home/Public/ns-allinone-2.33/lib, into your LD_LIBRARY_PATH environment variable. If it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH. If you are using csh, you can set it like: setenv LD_LIBRARY_PATH If you are using sh, you can set it like: export LD_LIBRARY_PATH=
(2) You MUST put /home/Public/ns-allinone-2.33/tcl8.4.18/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup. After these steps, you can now run the ns validation suite with cd ns-2.33; ./validate For trouble shooting, please first read ns problems page http://www.isi.edu/nsnam/ns/ns-problems.html Also search the ns mailing list archive for related posts.
之后就是更改环境变量
$sudo gedit .bashrc
在弹出的窗口文件最后输入(注意修改“yourfile”(就是自己NS上一级文件夹)
export PATH=$PATH:/home/yourfile/ns-allinone-2.34/bin:/home/yourfile/ns-allinone-2.34/tcl8.4.18/unix:/home/yourfile/ns-allinone-2.34/tk8.4.18/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/yourfile/ns-allinone-2.34/otcl-1.13:/home/yourfile/ns-allinone-2.34/lib
export TCL_LIBRARY=$TCL_LIBRARY:/home/yourfile/ns-alllinone-2.34/tcl8.4.18/library
然后输入ns 如果出现%表示NS安装成功。
参考网站:http://wenku.baidu.com/view/210c5a966bec0975f465e257.html
NS装得是ns-allinone-2.34,LEACH算法就是使用的MIT发布的包。以下是两个包的下载地址。
NS2:http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/
LEACH:http://www.baisi.net/viewthread.php?tid=10172&highlight=leach(PS:这个论坛有很多探讨,个人觉得不错,不是广告!!!)
下载完毕之后,首先是对ubuntu的更新
$sudo apt-get install build-essential
$sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev
$sudo apt-get install libxmu-dev libxmu-headers 这个主要是为了nam。就是那个图形化结果的东西。
理论上这些东西装了就好了,但是以防万一,可以把机子中其他部分也给update一下。
之后就是解压
$tar -xzf ns-allinone-2.34.tar.gz
完毕之后首先确定以下本机的gcc版本
$gcc -v
如果是大于4.0的
需要修改如下两个个地方
ns-allinone-2.34/otcl-1.13中, configure.in 的77行SHLIB_LD="ld -shared", 改为SHLIB_LD="gcc -shared"
ns-allinone-2.34/otcl-1.13中, configure 的6304行SHLIB_LD="ld -shared", 改为SHLIB_LD="gcc -shared"
注意,行数之针对2.34版本的ns2有效。
修改mac_802.11Ext.cc文件
在ns-2.34/mac/mac-802_11Ext.h 添加头文件引用 #include <cstddef>
完成之后,回到ns-allinone-2.34目录下,输入./install即可安装。
安装过程中可以出现以下几种错误:
(1)出现****::****()错误
tools/ranvar.cc: In member function ‘virtual double GammaRandomVariable::value()’:
tools/ranvar.cc:219:70: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly
tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’
make: *** [tools/ranvar.o]错误1
这个错误只需要进入ns-2.34/tools文件夹中对ranvar.cc文件的219行改一下就行,将::GammaRandomVariable删除即可。
后面还会有两个类似的错误,在ns-2.34/mobile/nakagami.cc文件中,183行和185行。
(2)这个问题我没复制下来,反正关键字是"erase" not declared之类的
这个需要打开相应的文件,然后找到相应的行数,在erase之前添加一个this->即可。
这个错误提示中会告诉你应该怎么改。
这些都OK了,那么NS应该会安装完毕。看到官网上所说的那个提示。
Please put /home/ns-allinone-2.33/bin:/home/ns-allinone-2.33/tcl8.4.18/unix:/home/Public/ns-allinone-2.33/tk8.4.18/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /home/ns-allinone-2.33/otcl-1.13, /home/Public/ns-allinone-2.33/lib, into your LD_LIBRARY_PATH environment variable. If it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH. If you are using csh, you can set it like: setenv LD_LIBRARY_PATH If you are using sh, you can set it like: export LD_LIBRARY_PATH=
(2) You MUST put /home/Public/ns-allinone-2.33/tcl8.4.18/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup. After these steps, you can now run the ns validation suite with cd ns-2.33; ./validate For trouble shooting, please first read ns problems page http://www.isi.edu/nsnam/ns/ns-problems.html Also search the ns mailing list archive for related posts.
之后就是更改环境变量
$sudo gedit .bashrc
在弹出的窗口文件最后输入(注意修改“yourfile”(就是自己NS上一级文件夹)
export PATH=$PATH:/home/yourfile/ns-allinone-2.34/bin:/home/yourfile/ns-allinone-2.34/tcl8.4.18/unix:/home/yourfile/ns-allinone-2.34/tk8.4.18/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/yourfile/ns-allinone-2.34/otcl-1.13:/home/yourfile/ns-allinone-2.34/lib
export TCL_LIBRARY=$TCL_LIBRARY:/home/yourfile/ns-alllinone-2.34/tcl8.4.18/library
然后输入ns 如果出现%表示NS安装成功。
参考网站:http://wenku.baidu.com/view/210c5a966bec0975f465e257.html
相关文章推荐
- ubuntu下NS2+leach算法安装笔记(2)
- (笔记)Ubuntu下安装arm-linux-gcc-4.4.3.tar.gz (交叉编译环境)
- ejabberd-2.1.6源码安装与配置笔记(Ubuntu 10.10)
- torch学习笔记1--Ubuntu安装torch
- Linu学习笔记之——ubuntu安装、卸载JDK1.7
- 第十一天堂的学习笔记Ubuntu第一篇,分区安装,设置root密码,安装五笔和VMtools
- ubuntu下安装PostgreSQL笔记
- 【记一笔】64位Win7和ubuntu13安装笔记
- Python笔记2:Ubuntu下安装MySQL及MySQL终端操作命令
- 学习web程序员角度ubuntu自修速学课程安装flash player笔记
- Ubuntu15.10_64位安装Theano+cuda7.5详细笔记
- ubuntu教程--12.04 安装笔记
- Ubuntu 11.04上安装jdk1.6+oracle 11g笔记
- Ubuntu系统学习笔记-3.Java和Tomcat安装
- 基于Ubuntu+Apache+Passenger+MySQL的Redmine安装笔记
- 开始hadoop前的准备:ubuntu学习笔记-基本环境的搭建(ssh的安装,SecureCRT连接,vim的安装及使用、jdk的安装)
- ubuntu安装Pangolin笔记
- Ubuntu笔记1_Ubuntu 13.04与win7双系统安装
- hadoop 学习笔记1 —— ubuntu上构建伪分布式的hadoop安装
- Thrift 学习笔记1——Ubuntu环境下Thrift的安装、编译以及测试