ns-allinone-2.34 installation on Ubuntu 12.10

本文详细介绍了NS2网络模拟器的安装步骤及过程中可能遇到的问题解决方案,包括环境变量设置、依赖包安装、编译错误修复等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1)     Downloadthe setup files from http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz/download

2)     Unpackedthe file and cd into the directory, run ./install to begin installation. Thereare some problems during the installation. I will list all of them here.

a.     While configure the status of tcl8.4.14, the installation process says that it cannotfind the file Makefile.in. I noticed that the path shown is wrong because Ihave install it in a directory whose name has a blank space. I correct thedirectory name then it become ok.

b.     While processing to install the otcl, something wrong happens again.


This is because gcc uses “gcc –shared”instaed of “ld –shared” to generate shared libaray after gcc 4.0 while. So weneed to change “ld –shared” into “gcc –shared” at the77th line of ./otcl-1.13/configure.in and the 6304th lineof ./otcl-1.13/configure.

c.    

This is an incompatibility caused by the simplified call to class function in the high version of gcc. Correct it by change the ranvar.cc at the 219th line from

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

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

d.     In file included from linkstate/ls.cc:67:0:

linkstate/ls.h: In instantiationof ‘void LsMap::eraseAll() [with Key = int; T = LsIdSeq]’:

linkstate/ls.cc:396:28: required from here

linkstate/ls.h:137:20: error:‘erase’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]

linkstate/ls.h:137:20: note:declarations in dependent base ‘std::map, std::allocator > >’ are not found by unqualified lookup

linkstate/ls.h:137:20: note: use‘this->erase’ instead

make: *** [linkstate/ls.o] Error 1

Ns make failed!

 

Solution: Edit ./ns-2.34/linkstate/ls.h,change from

void eraseAll() {erase(baseMap::begin(), baseMap::end()); }

to voideraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

e.     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’

make: *** [mobile/nakagami.o]Error 1

Ns make failed!

 

The same solution as c

f.       mac/mac-802_11Ext.h:In member function ‘u_int32_t PHY_MIBExt::getHdrLen11()’:

mac/mac-802_11Ext.h:176:19: error: expected primary-expressionbefore ‘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

 

Solution: Edit the./ns-2.34/mac/mac-802_11Ext.h and add #include<cstddef> to the header files.

3)     After all of the above processes, the ns2 is installed succesully. But we still need to set the environment variables.


Then run : source/etc/profile

And then check to see if it runswell.  Using ./ns-2.34/validate or do as follows. I recommend to run the validate process and it may take servaral minutes to complete.


If validate successfully, you can finally see the message below. Notice that it won’t terminate unless you pressCtrl+C.


But I still have a problem shown below during validation.


Just install the libperl4-corelibs-perlpackage and then everything goes well.

 

4)     Finally,you can also install the nam.

cd ./nam-1.14

./configure

make

sudo make install

If everything goes well, finally type the nam command and you can see the nam window.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值