how to install NS-2.33 installation in Ubuntu 12.04 and 14.4

Follow the below given steps:

Download ns-allinnone-2.33 from nasam website
copy to  home folder

extract zip file


            
1.sudo apt-get install update

 Install required libraries for ns2 using terminal

 2.sudo apt-get install build-essential autoconf automake libxmu-dev

3. sudo apt-get install xorg-dev g++ xgraph

 Then,  go to ns-allinone-2.33

4. ./install

For errors,


1.
ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Bad value
make: *** [libotcl.so] Error 1
otcl-1.13 make failed! Exiting ...
Solution:
In otcl-1.13/configure, line number 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 [-fpermissive]
tools/ranvar.cc:219:70: error:   for a function-style cast, remove the redundant ‘::GammaRandomVariable’ [-fpermissive]
make: *** [tools/ranvar.o] Error 1

Solution:
In ns-2.33/tools/ranvar.cc, line 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.
In file included from mac/mac-802_11Ext.cc:66:0:
mac/mac-802_11Ext.h: In member function ‘u_int32_t PHY_MIBExt::getHdrLen11()’:
mac/mac-802_11Ext.h:175:19: error: expected primary-expression before ‘struct’
mac/mac-802_11Ext.h:175:41: error: ‘dh_body’ was not declared in this scope
mac/mac-802_11Ext.h:175:51: error: ‘offsetof’ was not declared in this scope
mac/mac-802_11Ext.h:177:3: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [mac/mac-802_11Ext.o] Error 1
Ns make failed!

Solution:
In mac/mac-802_Ext.h, line 65

+#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 [-fpermissive]
mobile/nakagami.cc:183:73: error:   for a function-style cast, remove the redundant ‘::ErlangRandomVariable’ [-fpermissive]
mobile/nakagami.cc:185:67: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly [-fpermissive]
mobile/nakagami.cc:185:67: error:   for a function-style cast, remove the redundant ‘::GammaRandomVariable’ [-fpermissive]
make: *** [mobile/nakagami.o] Error 1

Solution:
In ns-2.33/mobile/nakagami.cc, Line no.

-if (int_m == m) {
-             resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();
-         } else {
-             resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();
-         }
-         return resultPower;
-    }

 +if (int_m == m) {
 +           resultPower = ErlangRandomVariable(Pr/m, int_m).value();
 +        } else {
 +            resultPower = GammaRandomVariable(m, Pr/m).value();
 +        }
 +       return resultPower;
 +   }


ns-2.33 on ubuntu 14.4


i've to edit the line number 137 of ns-2.35/linkstate/ls.h from


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

 
to


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



Path Setup:

In terminal sudo gedit ~/.bash_aliases

Then update the environmrnt variable

# LD_LIBRARY_PATH
OTCL_LIB=/home/om/ns-allinone-2.33/otcl-1.13
NS2_LIB=/home/om/ns-allinone-2.33/lib
#X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/home/om/ns-allinone-2.33/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/om/ns-allinone-2.33/bin:/home/om/ns-allinone-2.33/tcl8.4.18/unix:/home/om/ns-allinone-2.33/tk8.4.18/unix
NS=/home/om/ns-allinone-2.33/ns-2.33/
NAM=/home/om/ns-allinone-2.33/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM

cd ns-2.33
./validate



 

Comments

Post a Comment

Popular posts from this blog

how to install Eclipse IDE on Ubuntu 11.10

How to Install NS All In One 2.35 in Ubuntu 12.04

Leach protocol installation in network simulator 2