Skip to main content

Installing ns-2.29 in Ubuntu 12.04

Off late, we try to use(install) a old software in a new Operating System for want of backward compatibility or to survey.  This following post shows you how to install ns-2.29 in Ubuntu 12.04.

Unlike other ns2 installations, this installation has so many errors, warnings and patchings. Once everything is overcome, ns installs successfully

Step 1: Download and untar ns-2.29 from this link (http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.29/ns-allinone-2.29.3.tar.gz/download)

Step 2: install the necessary dependancy packages using the command "sudo apt-get install build-essential libxmu-dev autoconf automake" (without quotes). This will install the necessary developmental packages

Step 3: Since ns-2.29 is older software, some of the pointer conversion have to be changed inside ns-2.29

Step 4: go to terminal, point to the location of ns-allinone-2.29 using the command "cd ~/ns-allinone-2.29/" and type "./install"

Step 5: there may be the following errors during the installation, please correct one by one

1. OTcl-1.11 error make failed.

for this error, open the file under the folder otcl-1.11/configure.in and go to line number  

Change the following block to 

 Linux*)

        SHLIB_CFLAGS="-fpic"

        SHLIB_LD="ld -shared"

        SHLIB_SUFFIX=".so"

        DL_LIBS="-ldl"

        SHLD_FLAGS=""

        ;;

Linux*)
        SHLIB_CFLAGS="-fpic"
        SHLIB_LD="gcc -shared"
        SHLIB_SUFFIX=".so"
        DL_LIBS="-ldl"
        SHLD_FLAGS=""
        ;;
2. tclcl-1.17 error, in line number 566 of Tcl.cc file (~tclcl-1.17/Tcl.cc) (See the upper case Tcl.cc)
change the following to 
char *p = strchr(localName, '(');
this following line
char *p =const_cast<char*>( strchr(localName, '('));
3. there will be so many errors in the queue/ folder (~ns-allinone-2.29/ns-2.29/queue/), there may be some pointer conversion errors
Error 1:
------
queue/red.cc:877:41: error: invalid conversion from ‘const char*’ to ‘char*’
make: *** [queue/red.o] Error 1
In queue/red.cc at 874 line
Change the following to
 
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) ) {
this 
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) ) {

Error 2:
queue/rio.cc:568:36: error: invalid conversion from ‘const char*’ to ‘char*’
queue/rio.cc:569:39: error: invalid conversion from ‘const char*’ to ‘char*’
queue/rio.cc:570:40: error: invalid conversion from ‘const char*’ to ‘char*’
queue/rio.cc:571:36: error: invalid conversion from ‘const char*’ to ‘char*’
make: *** [queue/rio.o] Error 1
 

in queue/rio.cc and in line number 565 
 find the following lines
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)) {

and replace these lines
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)) {
Error 3: 
queue/pi.cc:316:36: error: invalid conversion from ‘const char*’ to ‘char*’
queue/pi.cc:317:36: error: invalid conversion from ‘const char*’ to ‘char*’
make: *** [queue/pi.o] Error 1



in queue/pi.cc at line number 316
Find these lines and 
if (((p = strstr(v->name(), "prob")) == NULL) &&
    ((p = strstr(v->name(), "curq")) == NULL)) {
replace with these lines

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

Error 4:
 
queue/vq.cc: In member function ‘virtual void Vq::trace(TracedVar*)’:
queue/vq.cc:333:35: error: invalid conversion from ‘const char*’ to ‘char*’
make: *** [queue/vq.o] Error 1
Find the following line and
if ((p = strstr(v->name(), "curq")) == NULL) {
replace this line
if ((p = const_cast<char*>(strstr(v->name(), "curq"))) == NULL) {

 
Error 5
queue/rem.cc:337:36: error: invalid conversion from ‘const char*’ to ‘char*’
queue/rem.cc:338:36: error: invalid conversion from ‘const char*’ to ‘char*’
make: *** [queue/rem.o] Error 1

In queue/rem.cc: in line number 336
Find the following lines and 
if (((p = strstr(v->name(), "ave")) == NULL) &&
    ((p = strstr(v->name(), "prob")) == NULL) &&
    ((p = strstr(v->name(), "curq")) == NULL)) {

replace these lines
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)) {


Error 6: 
queue/gk.cc:207:35: error: invalid conversion from ‘const char*’ to ‘char*’
make: *** [queue/gk.o] Error 1

In queue/gk.cc in line number 207
find the following line and 
if ((p = strstr(v->name(), "curq")) == NULL) {
 replace this line
if ((p = const_cast<char*>(strstr(v->name(), "curq"))) == NULL) {
Step 6: Once the errors are corrected, go back to ns-allinone-2.29 and press ./install and see whether the installation is successful
Step 7: Set the PATH information in /home/pradeep/.bashrc and  execute "source .bashrc"
Check whether ns and nam are working (for me nam was not working, Since mine is ubuntu I installed NAM separately using "sudo apt-get install nam"
Thats all!!!!.

Comments

  1. I succesfuulyinstal otcl but getting error in tcl.This is the error i am getting...

    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:54: error: expected ‘)’ before ‘;’ token
    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 ...

    ReplyDelete
    Replies
    1. See the post, it contains the info to correct the Tcl.cc error.

      Delete
  2. Thank You very Much Sir for sharing such a nice and useful material. Help me a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Babar Shah
    PhD scholar

    ReplyDelete
  3. Thankz a lott SIR, itz working

    ReplyDelete

Post a Comment

Popular posts from this blog

Installation of ns2 in Ubuntu 18.04 - NS2 Tutorial # 2

ns2 installation in Ubuntu 18.04

Unlike earlier version of ubuntu, the 18,04 version does not support the direct installation of ns2, because of the latest C/C++ compiler (7.x), but the latest C/C++ compiler supported by ns2 is gcc-4.8. So this post and video tells you about the installation of gcc-4.8 version, then ns2 and then configuration.
Here are the steps, Please follow the video given below for more information.

$] tar zxvf ns-allinone-2.35.tar.gz


$] sudo apt install gcc-4.8 g++-4.8

if you have installed ubuntu just now, you can try these commands also in the beginning

$] sudo apt update
$] sudo apt install build-essential autoconf automake libxmu-dev

$] cd ns-allinone-2.35/ns-2.35
$] gedit Makefile.in
$] gedit linkstate/ls.h

line number 137, change erase to this->erase
$] cd ..
$] ./install

export PATH=$PATH:/home/pradeepkumar/ns-allinone-2.35/bin:/home/pradeepkumar/ns-allinone-2.35/tcl8.5.10/unix:/home/pradeepkumar/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$L…

AWK Scripts for NS2 to process data from Trace Files

AWK Scripts are very good in processing the data from the log (trace files) which we get from NS2. If you want to process the trace file manually, here is the detailHere is a sample of trace file from NS2 (However ns2 supports a new type of trace file also), but this post will make you understand the old trace format only.r 0.030085562 _0_ MAC  --- 0 message 32 [0 ffffffff 1 800] ------- [1:255 -1:255 32 0] r 0.030110562 _0_ RTR  --- 0 message 32 [0 ffffffff 1 800] ------- [1:255 -1:255 32 0] s 1.119926192 _0_ RTR  --- 1 message 32 [0 0 0 0] ------- [0:255 -1:255 32 0]
AWK Scripts are very good in processing the data column wise. For example
the first column in the above trace file represents r, s which indicates receive, sent respectively. If we want to trace the entire r and s alone from this trace file we can represent it as $1
So
$1 represents ACTION
$2 Time
$3 Node ID
$4 Layer
$5 Flags
$6 seqno
$7 type
$8 Size
$14 Energy (if the network nodes includes EnergyModel)To run the awk script in Li…

ns3 installation in Ubuntu 16.04

This post serves the installation instructions of ns3 in ubuntu 16.04 version. Some of my students are working in ns3, this post will benefit them in installing ns3.

OS Used: Ubuntu 16.04.4
ns3 version: ns3 version 3.27

The same procedure will be applied for OS like Debian, Linux Mint.

Fresh installation of Ubuntu 16.04 Let you try the fresh installation of ubuntu in your hard disk along with windows.
Installation of ns3 dependencies ns3 needs so many dependencies, developmental libraries, drivers, etc. so install all those
$] sudo apt update  $] sudo apt upgrade
$] sudo apt-get install build-essential autoconf automake libxmu-dev python-pygoocanvas python-pygraphviz cvs mercurial bzr git cmake p7zip-full python-matplotlib python-tk python-dev python-kiwi python-gnome2 python-gnome2-desktop-dev python-rsvg qt4-dev-tools qt4-qmake qt4-qmake qt4-default gnuplot-x11 wireshark
The above command make take some time to download, compile and install it, Be Patient. 
Installing ns3 Download the…