Friday, December 14, 2012

NS-2.29 installation in Ubuntu 12.04

The below given details are the errors and solutions, which I found while installing.

1.
Build tcl8.4.11
============================================================
loading cache ./config.cache
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for building with threads... no (default)
checking if the compiler understands -pipe... yes
checking how to run the C preprocessor... gcc -pipe -E
checking for sin... no
checking for main in -lieee... yes
checking for main in -linet... no
checking for net/errno.h... no
checking for connect... yes
checking for gethostbyname... yes
checking how to build libraries... static
checking for ranlib... ranlib
checking if 64bit support is requested... no
checking if 64bit Sparc VIS support is requested... no
checking system version (for dynamic loading)... ./configure: 1: Syntax error: Unterminated quoted string
tcl8.3.2 configuration failed! Exiting ...
Tcl is not part of the ns project. Please see www.Scriptics.com
to see if they have a fix for your platform.

Solution:
Basically, in some of the configure scripts the calls to awk are malformed.

    Go to the ns-allinone folder and type

    find . -name configure

A list of the configure scripts should appear.

    For each of these replace any line that looks like this:

    system=MP-RAS-`awk ‘{print }’ /etc/.relid’`

    with ...

    system=MP-RAS-`awk ‘{print }’ /etc/.relid`

Now rerun ./install in the ns-allinone folder.



2.
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 ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In otcl-1.13/configure, line number 5516

-  SHLIB_LD="ld -shared"

+SHLIB_LD="gcc -shared" 

3.
Tcl.cc: In member function ‘void Tcl::eval(char*)’:
Tcl.cc:182:8: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Tcl.cc: In member function ‘int TclObject::traceVar(const char*, TclObject*)’:
Tcl.cc:421:50: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Tcl.cc: In static member function ‘static int TclClass::create_shadow(ClientData, Tcl_Interp*, int, const char**)’:
Tcl.cc:509:57: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Tcl.cc:511:61: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Tcl.cc: In static member function ‘static int TclClass::dispatch_instvar(ClientData, Tcl_Interp*, int, const char**)’:
Tcl.cc:566:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
Tcl.cc:571:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Tcl.cc: In member function ‘virtual void TclClass::bind()’:
Tcl.cc:603:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Tcl.cc:605:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [Tcl.o] Error 1
tclcl-1.17 make failed! Exiting ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Soultion:
Go to file tclcl-1.17/tcl.cc at line no. 564 replace the line following line

- char *p =strchr(localName, '(');
+ char *p =const_cast<char*>( strchr(localName, '('));


4.
./sctp/sctp.h:558:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
./sctp/sctp.h:564:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
./sctp/sctp.h:571:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
./sctp/sctp.h:577:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]
./sctp/sctp.h:705:8: error: extra qualification ‘SctpAgent::’ on member ‘DumpSendBuffer’ [-fpermissive]
trace/trace.cc:185:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
trace/trace.cc:185:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
trace/trace.cc:185:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
trace/trace.cc:185:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
trace/trace.cc:185:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [trace/trace.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In file sctp/sctp.h in line 705, please change as follows:

- void SctpAgent::DumpSendBuffer();
+void DumpSendBuffer();


5.
In file included from ./trace/cmu-trace.h:43:0,
                 from src_rtg/sragent.cc:53:
./mobile/god.h: At global scope:
./mobile/god.h:88:14: error: extra qualification ‘vector::’ on member ‘operator=’ [-fpermissive]
./mobile/god.h:93:14: error: extra qualification ‘vector::’ on member ‘operator+=’ [-fpermissive]
./mobile/god.h:98:13: error: extra qualification ‘vector::’ on member ‘operator==’ [-fpermissive]
./mobile/god.h:101:13: error: extra qualification ‘vector::’ on member ‘operator!=’ [-fpermissive]
make: *** [src_rtg/sragent.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
The changes to be done to solve this problem is in the file mobile/god.h

In line 88, 93, 98 and 101 
remove vector::


6.
queue/red.cc: In member function ‘double REDQueue::estimator(int, int, double, double)’:
queue/red.cc:388:18: warning: variable ‘old_ave’ set but not used [-Wunused-but-set-variable]
queue/red.cc: In member function ‘virtual void REDQueue::trace(TracedVar*)’:
queue/red.cc:874:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/red.cc:875:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/red.cc:876:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/red.cc:877:41: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
make: *** [queue/red.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
 In file queue/red.cc at line 874,


-if (((p = strstr(v->name(), "ave")) == NULL) &&
-        ((p = strstr(v->name(), "prob")) == NULL) &&
-        ((p = strstr(v->name(), "curq")) == NULL) &&
-        ((p = strstr(v->name(), "cur_max_p"))==NULL) ) {

+if (((p = const_cast<char*>(strstr(v->name(), "ave"))) == NULL) &&
+       ((p = const_cast<char*>(strstr(v->name(), "prob"))) == NULL) &&
+        ((p = const_cast<char*>(strstr(v->name(), "curq"))) == NULL) &&
+        ((p = const_cast<char*>(strstr(v->name(), "cur_max_p")))==NULL) ) {


7.
dsr/dsragent.cc:2737:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
dsr/dsragent.cc:2756:28: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [dsr/dsragent.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In dsr/dsragent.cc at line 216 add following lines,

void XmitFlowFailureCallback(Packet *pkt, void *data);
void XmitFailureCallback(Packet *pkt, void *data);


8.
diffusion/diffusion.cc: In member function ‘void DiffusionAgent::MACprepare(Packet*, nsaddr_t, int, bool)’:
diffusion/diffusion.cc:427:26: error: ‘XmitFailedCallback’ was not declared in this scope
make: *** [diffusion/diffusion.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In diffusion/diffusion.cc at line 85 add following line,

void XmitFailedCallback(Packet *pkt, void *data);

9.
diffusion/omni_mcast.cc: In member function ‘void OmniMcastAgent::ConsiderNew(Packet*)’:
diffusion/omni_mcast.cc:243:19: warning: variable ‘hashPtr’ set but not used [-Wunused-but-set-variable]
diffusion/omni_mcast.cc:246:27: warning: variable ‘forward_nodeID’ set but not used [-Wunused-but-set-variable]
diffusion/omni_mcast.cc: In member function ‘void OmniMcastAgent::MACprepare(Packet*, nsaddr_t, unsigned int, bool)’:
diffusion/omni_mcast.cc:388:26: error: ‘OmniMcastXmitFailedCallback’ was not declared in this scope
make: *** [diffusion/omni_mcast.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In diffusion/omni_mcast.cc at line 83 add followinf line

void OmniMcastXmitFailedCallback(Packet *pkt, void *data);


10.
queue/rio.cc: In member function ‘virtual void RIOQueue::enque(Packet*)’:
queue/rio.cc:481:56: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
queue/rio.cc: In member function ‘virtual void RIOQueue::trace(TracedVar*)’:
queue/rio.cc:565:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/rio.cc:566:38: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/rio.cc:567:39: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/rio.cc:568:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/rio.cc:569:39: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/rio.cc:570:40: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/rio.cc:571:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
make: *** [queue/rio.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
Do the following changes in queue/rio.cc at line 565 onwards,

-    if (((p = strstr(v->name(), "ave")) == NULL) &&
-        ((p = strstr(v->name(), "in_ave")) == NULL) &&
-        ((p = strstr(v->name(), "out_ave")) == NULL) &&
-        ((p = strstr(v->name(), "prob")) == NULL) &&
-        ((p = strstr(v->name(), "in_prob")) == NULL) &&
-        ((p = strstr(v->name(), "out_prob")) == NULL) &&
-        ((p = strstr(v->name(), "curq")) == NULL)) {
       

+    if (((p = const_cast<char*>(strstr(v->name(), "ave"))) == NULL) &&
+            ((p = const_cast<char*>(strstr(v->name(), "in_ave"))) == NULL) &&
+            ((p = const_cast<char*>(strstr(v->name(), "out_ave"))) == NULL) &&
+            ((p = const_cast<char*>(strstr(v->name(), "prob"))) == NULL) &&
+            ((p = const_cast<char*>(strstr(v->name(), "in_prob"))) == NULL) &&
+            ((p = const_cast<char*>(strstr(v->name(), "out_prob"))) == NULL) &&
+            ((p = const_cast<char*>(strstr(v->name(), "curq"))) == NULL)) {


11.
tcp/tcp-sack-rh.cc: At global scope:
tcp/tcp-sack-rh.cc:68:15: error: extra qualification ‘SackRHTcpAgent::’ on member ‘newack’ [-fpermissive]
make: *** [tcp/tcp-sack-rh.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In tcp/tcp-sack-rh.cc at line 68,

-    virtual void SackRHTcpAgent::newack(Packet* pkt);
+    virtual void newack(Packet* pkt);

12.
queue/pi.cc: In member function ‘virtual void PIQueue::trace(TracedVar*)’:
queue/pi.cc:316:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/pi.cc:317:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
make: *** [queue/pi.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In queue/pi.cc at line 316, do the following changes,

-    if (((p = strstr(v->name(), "prob")) == NULL) &&
-        ((p = strstr(v->name(), "curq")) == NULL)) {

+    if (((p = const_cast<char*>(strstr(v->name(), "prob"))) == NULL) &&
+        ((p = const_cast<char*>(strstr(v->name(), "curq"))) == NULL)) {


13.
queue/vq.cc: In member function ‘virtual void Vq::trace(TracedVar*)’:
queue/vq.cc:333:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
make: *** [queue/vq.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In file queue/vq.cc at line 333,

-    if ((p = strstr(v->name(), "curq")) == NULL) {
+    if ((p = const_cast<char*>(strstr(v->name(), "curq"))) == NULL) {


14.
queue/rem.cc: In member function ‘virtual void REMQueue::trace(TracedVar*)’:
queue/rem.cc:335:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/rem.cc:336:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
queue/rem.cc:337:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
make: *** [queue/rem.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In file queue/rem.cc at line 335,

-    if (((p = strstr(v->name(), "ave")) == NULL) &&
-        ((p = strstr(v->name(), "prob")) == NULL) &&
-        ((p = strstr(v->name(), "curq")) == NULL)) {

+   if (((p =const_cast<char*>(strstr(v->name(), "ave"))) == NULL) &&
+       ((p = const_cast<char*>(strstr(v->name(), "prob"))) == NULL) &&
+       ((p = const_cast<char*>(strstr(v->name(), "curq"))) == NULL)) {


15.
queue/gk.cc: In member function ‘virtual void GK::trace(TracedVar*)’:
queue/gk.cc:207:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
make: *** [queue/gk.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution:
In file queue/gk.cc at line 207,

-    if ((p = strstr(v->name(), "curq")) == NULL) {
+    if ((p = const_cast<char*>(strstr(v->name(), "curq"))) == NULL) {


16.
pgm/pgm-agent.cc: At global scope:
pgm/pgm-agent.cc:307:8: error: extra qualification ‘PgmAgent::’ on member ‘trace_event’ [-fpermissive]
pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_rdata(Packet*)’:
pgm/pgm-agent.cc:607:30: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_nak(Packet*)’:
pgm/pgm-agent.cc:756:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_ncf(Packet*)’:
pgm/pgm-agent.cc:853:28: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [pgm/pgm-agent.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problem

Solution
In pgm/pgm-agent.cc at line 307,

-  void PgmAgent::trace_event(char *evType, double evTime);
+  void trace_event(char *evType, double evTime);


17.
pgm/pgm-sender.cc: At global scope:
pgm/pgm-sender.cc:189:8: error: extra qualification ‘PgmSender::’ on member ‘trace_event’ [-fpermissive]
pgm/pgm-sender.cc: In member function ‘virtual void PgmSender::handle_nak(Packet*)’:
pgm/pgm-sender.cc:501:67: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
pgm/pgm-sender.cc: In member function ‘virtual void PgmSender::send_rdata(RdataItem*)’:
pgm/pgm-sender.cc:645:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [pgm/pgm-sender.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution
In pgm/pgm-sender.cc at line 189,

-  void PgmSender::trace_event(char *evType, nsaddr_t daddr, double evTime);
+  void trace_event(char *evType, nsaddr_t daddr, double evTime);


18.
pgm/pgm-receiver.cc: At global scope:
pgm/pgm-receiver.cc:186:8: error: extra qualification ‘PgmReceiver::’ on member ‘trace_event’ [-fpermissive]
pgm/pgm-receiver.cc: In member function ‘void PgmReceiver::generate_Nak(int)’:
pgm/pgm-receiver.cc:617:34: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [pgm/pgm-receiver.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

Solution
In pgm/pgm-sender.cc at line 186,

-   void PgmReceiver::trace_event(char *evType, double evTime);
+   void trace_event(char *evType, double evTime);

Saturday, November 17, 2012

nrlsensorsim patching to ns-2.27

Please find the details in the below given link:

http://ppvbhat.blogspot.in/2012/07/ns-227-installation-on-fc8-with.html

Tuesday, October 23, 2012

GnuPlot installation in Ubuntu 12.04

We need to make sure some packages are already installed before we try to compile gnuplot

  1. sudo apt-get install libwxgtk2.8-dev libpango1.0-dev libreadline5-dev libx11-dev libxt-dev texinfo libgd2-xpm-dev
  2. wget http://sourceforge.net/projects/gnuplot/files/gnuplot/4.4.0/gnuplot-4.4.0.tar.gz/download
  3. tar xzf gnuplot-4.4.0.tar.gz
  4. cd  gnuplot-4.4.0
  5. ./configure
  6. sudo make install 

Saturday, October 20, 2012

Installing NS-2.31 in Ubuntu 12.04

Follow the below given steps:


  • Download ns-allinnone-2.31 from nasam website
             http://sourceforge.net/projects/nsnam/files/ns-2
  • Create a folder in /home with the name ns2
  •  Extract the tar file in ns2 
  • Open terminal and type cd ns2/ns-allinone-2.31
  •  Install required libraries for ns2 using terminal
            sudo apt-get install build-essential autoconf automake libxmu-dev
  •  Then, sudo ./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 ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems


Solution:
In otcl-1.13/configure, line number 5516

-SHLIB_LD="ld -shared"
+SHLIB_LD="gcc -shared"


Friday, September 7, 2012

NS-2.34 installation in Ubuntu 12.04

Follow the below given steps:

  • Download ns-allinnone-2.34 from nasam website
             http://sourceforge.net/projects/nsnam/files/ns-2
  • Create a folder in home with name ns2
  •  Extract the tar file in ns2 
  • Open terminal and type cd ns2/ns-allinone-2.34
  •  Install required libraries for ns2 using terminal
            sudo apt-get install build-essential autoconf automake libxmu-dev
  •  Then, sudo ./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.34/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.34/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;
     +   }


    Path Setup:
    • In terminal sudo gedit ~/.bash_aliases 
    • Then copy the following path and modify according to your system path

    # LD_LIBRARY_PATH
    OTCL_LIB=/home/ramakrishna/ns2/ns-allinone-2.34/otcl-1.13
    NS2_LIB=/home/ramakrishna/ns2/ns-allinone-2.34/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/ramakrishna/ns2/ns-allinone-2.34/tcl8.4.18/library
    USR_LIB=/usr/lib
    export TCL_LIBRARY=$TCL_LIB:$USR_LIB

    # PATH
    XGRAPH=/home/ramakrishna/ns2/ns-allinone-2.34/bin:/home/ramakrishna/ns2/ns-allinone-2.34/tcl8.4.18/unix:/home/ramakrishna/ns2/ns-allinone-2.34/tk8.4.18/unix
    NS=/home/ramakrishna/ns2/ns-allinone-2.34/ns-2.34/
    NAM=/home/ramakrishna/ns2/ns-allinone-2.34/nam-1.14/
    PATH=$PATH:$XGRAPH:$NS:$NAM


    • Save the file and type source ~/.bash_aliases
     Now if you type ns in terminal it will show % symbol