Ubuntu上安装ns2-2.34

步骤1

下载ns-allinone-2.34

$ tar zxf ns-allinone-2.34.tar.gz

步骤2

sudo apt-get install build-essential    # GCC

sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev   # for TCL and TK

sudo apt-get install libxmu-dev libxmu-headers    # for nam

步骤3

./install

出现的错误

问题1

ld -shared-o libotcl.so otcl.o
otcl.o: Infunction `OTclDispatch':
/usr/ns-allinone-2.34/otcl-1.13/otcl.c:495:undefined reference to `__stack_chk_fail_local'
otcl.o: Infunction `Otcl_Init':
/usr/ns-allinone-2.34/otcl-1.13/otcl.c:2284:undefined reference to `__stack_chk_fail_local'
ld:libotcl.so: hidden symbol `__stack_chk_fail_local' isn'tdefined
ld: finallink failed: Nonrepresentable section on output
make: ***[libotcl.so]错误1
otcl-1.13make failed! Exiting ...

$ cd ns-allinone-2.34/otcl-1.13

$ gedit configure.in

把77行处的:
SHLIB_LD="ld -shared",
改为;

SHLIB_LD="gcc -shared"

$ gedit configure

将6304行处的:

SHLIB_LD="ld -shared"

改为:

SHLIB_LD="gcc -shared"

问题2

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 make failed!

See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

在ns-allinone-2.33/ ns-2.33/tools文件夹下,找到报错提示中的ranvar.cc文件,打开找到对应的219行删除::GaammaRandomVariable,保存,

即:将219行的

return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

改为:

return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

问题3

mac/mac-802_11Ext.h: In member function ‘u_int32_t PHY_MIBExt::getHdrLen11()’:
mac/mac-802_11Ext.h:176:19: error: expected primary-expression before ‘struct’
mac/mac-802_11Ext.h:176:41: error: ‘dh_body’ was not declared in this scope
mac/mac-802_11Ext.h:176:51: error: ‘offsetof’ was not declared in this scope

在ns-allinone-2.34\ns-2.34\mac\mac-802_11Ext.h 文件添加#include <cstddef>
然后重新安装

问题4

mobile/nakagami.cc: In member function ‘virtual double Nakagami::Pr(PacketStamp*, PacketStamp*, WirelessPhy*)’:

mobile/nakagami.cc:183:73: error: cannot call constructor ‘ErlangRandomVariable::ErlangRandomVariable’ directly

mobile/nakagami.cc:183:73: error:  for a function-style cast, remove the redundant ‘::ErlangRandomVariable’

mobile/nakagami.cc:185:67: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly

mobile/nakagami.cc:185:67: error:  for a function-style cast, remove the redundant ‘::GammaRandomVariable’

在ns-allinone-2.34/ ns-2.34/ mobile文件夹下,找到报错提示中的nakagami.cc文件,打开找到对应的183行删除::ErlangRandomVariable,保存,

即:将183行的

resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();

改为:

resultPower = ErlangRandomVariable(Pr/m, int_m).value();

在ns-allinone-2.34/ ns-2.34/ mobile文件夹下,找到报错提示中的nakagami.cc文件,打开找到对应的185行删除::GammaRandomVariable,保存,

即:将185行的

resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();

改为:

resultPower = GammaRandomVariable(m, Pr/m).value();

步骤4

设置环境变量

# gedit ~/.bashrc

export LD_LIBRARY_PATH=/root/NS2/ns-allinone-2.34/otcl-1.13:/root/NS2/ns-allinone-2.34/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=/root/NS2/ns-allinone-2.34/tcl8.4.18/library
export PATH=/root/NS2/ns-allinone-2.34/bin:/root/NS2/ns-allinone-2.34/tcl8.4.18/unix:/root/NS2/ns-allinone-2.34/tk8.4.18/unix:$PATH

Ubuntu上安装ns2-2.34的更多相关文章

  1. 使用PPA在Ubuntu上安装php5.4~5.6,7

    使用PPA在Ubuntu上安装php5.4~5.6,7 sudo apt-get install software-properties-common sudo add-apt-repository ...

  2. 在Ubuntu上安装Chrome Driver和Firefox Driver

    在Ubuntu上安装Chrome Driver和Firefox Driver 此文章只介绍Chrome Driver(Firefox Driver和该步骤相同) 下载链接:http://chromed ...

  3. [异常解决] ubuntu上安装JLink驱动遇到的坑及给后来者的建议

    一.前言 最近将整个电脑格式化,改成了linux操作系统 希望这样能让自己在一个新的世界探索技术.提升自己吧- win上的工具用多了,就不想变化了- 继上一篇<ubuntu上安装虚拟机遇到的问题 ...

  4. Ubuntu上安装Robomongo及添加到启动器

    到目前为止,Robomongo仍是MongoDB最好的客户端管理工具,如需在Ubuntu上安装Robomongo,可直接从官网下载.tar.gz压缩包进行解压,然后直接运行bin目录下的robomon ...

  5. 在 Ubuntu 上安装 Android Studio

    在 Ubuntu 上安装 Android Studio http://www.linuxidc.com/Linux/2013-05/84812.htm 打开terminal,输入以下命令 sudo a ...

  6. Ubuntu上安装Karma失败对策

    在Ubuntu上安装Karma遇到超时 timeout 错误.Google了一下,国外的码农给了一个快捷的解决方案,实测可行,贴在这里: sudo apt-get install npm nodejs ...

  7. 在Ubuntu上安装LAMP服务器

    1.安装Ubuntu上安装LAMP apt-get install lamp-server^ 2.安装过程中设置MySql密码 3.测试 创建index.php var/www/html/index. ...

  8. [译]How to Setup Sync Gateway on Ubuntu如何在ubuntu上安装sync-gateway

    参考文章https://hidekiitakura.com/2015/03/21/how-to-setup-sync-gateway-on-ubuntudigitalocean/ 在此对作者表示感谢 ...

  9. 在Ubuntu上安装JDK、Ant、Jmeter和Jenkins

    一.前期准备 1. 在win7下载VMware.Ubuntu(用迅雷下比较快) 2. 安装完VMware后新建虚拟机,选择iso: 3. 具体配置参考如下,至此Ubantu安装完成 二.在Ubuntu ...

随机推荐

  1. 借助取色工具ColorPix对Pycharm编辑器设定自己喜欢的代码颜色_20161202

    1.Pycharm编辑器怎么设定自己喜欢的颜色,前几天看爬虫博客,看博主贴出的代码颜色很是喜欢,如下图,设置了好多次找不到他设定的颜色. 2.下班回家想起来之前做表的时候用到过一个取色工具ColorP ...

  2. easyui1.32 各种问题汇总

    问题一 场景:tab切换,每个tab里用div放一个dataGrid,默认display:none隐藏,当display:'block'的时候,dataGrid会显示不全,仅显示一条线. 解决方法:切 ...

  3. java 堆栈

    堆栈(stack).位于通用RAM中,但通过它的“堆栈指针”可以从处理器哪里获得支持.堆栈指针若向下移动,则分配新的内存:若向上移动,则释放那些 内存.这是一种快速有效的分配存储方法,仅次于寄存器. ...

  4. 一步一步写平衡二叉树(AVL树)

    平衡二叉树(Balanced Binary Tree)是二叉查找树的一个进化体,也是第一个引入平衡概念的二叉树.1962年,G.M. Adelson-Velsky 和 E.M. Landis发明了这棵 ...

  5. 利用Maven建立java web项目

    方法一:在IntelliJ IDEA中创建maven web项目 一.在新建项目对话框中,选择“Maven”类型,设置好jdk,勾选“create from archetype”,在列表中选择“mav ...

  6. MCS-51系列特殊功能寄存器(摘抄)

    1. P0 (80H) P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0 2.SP 栈指针(81H) 3.DPTR 数据指针(由DPH和DPL组成) DPL 数据指针低八 ...

  7. 浅析Android中ndk-build支持的参数

    在解决Android Studio中编译native code出现的问题时,发现Android Studio使用了完整的ndk-build命令进行编译,参数众多.故在此做一个说明,以便大家可以根据偏好 ...

  8. UVA315 (无向图求割点)

    题目大意:给定一个无向图,问共存在多少个割点.(割点:去掉此点后此图会断开连接)割点有两种存在:一种是第一次搜索的根节点,若其子节点数超过两个,则此点去掉后图会 断开连接,因此此点为割点:或者此点为搜 ...

  9. Particle Playground 3.03 - 粒子特效王者

    <ignore_js_op> <ignore_js_op> <ignore_js_op> <ignore_js_op> <ignore_js_op ...

  10. 用PHP将Unicode 转化为UTF-8

    function unescape($str) { $str = rawurldecode($str); preg_match_all("/(?:%u.{4})|&#x.{4};|& ...