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:LDLIBRARYPATHexportTCLLIBRARY=/root/NS2/nsallinone2.34/tcl8.4.18/libraryexportPATH=/root/NS2/nsallinone2.34/bin:/root/NS2/nsallinone2.34/tcl8.4.18/unix:/root/NS2/nsallinone2.34/tk8.4.18/unix:LDLIBRARYPATHexportTCLLIBRARY=/root/NS2/ns−allinone−2.34/tcl8.4.18/libraryexportPATH=/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

 本文转自cococo点点博客园博客,原文链接:http://www.cnblogs.com/coder2012/p/3443961.html,如需转载请自行联系原作者

相关文章
|
5月前
|
Ubuntu Linux 数据安全/隐私保护
vm安装Ubuntu以及Ubuntu设置中文
vm安装Ubuntu以及Ubuntu设置中文
137 0
|
5月前
|
Ubuntu 网络安全 虚拟化
【Ubuntu】Win11 VmWare虚拟机安装Ubuntu 22.04.1-server
【Ubuntu】Win11 VmWare虚拟机安装Ubuntu 22.04.1-server
123 1
【Ubuntu】Win11 VmWare虚拟机安装Ubuntu 22.04.1-server
|
7月前
|
Ubuntu
[Ubuntu][记录]ubuntu问题
[Ubuntu][记录]ubuntu问题
|
Ubuntu
ubuntu配置IP并且生效
ubuntu配置IP并且生效
797 0
ubuntu配置IP并且生效
|
Linux 数据安全/隐私保护
【系统】[CentOS]装完CentOS7重启提示Initial setup of CentOS Linux 7 (core)
【系统】[CentOS]装完CentOS7重启提示Initial setup of CentOS Linux 7 (core)
390 0
【系统】[CentOS]装完CentOS7重启提示Initial setup of CentOS Linux 7 (core)
|
Ubuntu Linux 虚拟化
Ubuntu Desktop变为Ubuntu Server服务器版的方法
<p>去Ubuntu官网看到有好几种版本可以下载,alternate(文本安装)、desktop9(桌面)、netbook(上网本)、server(服务器)。<br> 使用server版某个理由:<br> 32位的系统可以使用4G以上的内存,最多能到64G。前提是主板能够支持<br> 特别提示。<br> 32位系统,打开内存得映射功能后,系统将不能使用休眠功能(休眠与待机不同)<b
5318 0
|
Ubuntu Linux Docker
为Ubuntu Linux安装Docker CE Edge
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.
1658 0