Hi Folks,
Recently, I had been trying to install ns-2.34 in my ubuntu 12.04 which i have on a HP G62 pavilion notebook. Although i successfully installed it many a times but it was just a basic install (i.e. for a noob to work upon with basic tcl scripting and viewing simulations). Installing it completely without any compilation errors was the most challenging task as in order to modify ns2 u have to install it flawlessly.
In this post I shall teach you how to install ns-2.34 in ubuntu 12.04 (specifically).
First of all u need to download my version of ns-2.34 from the link given below. In this version of ns-2.34, I have made all the necessary changes (i.e. to Makefile and certain other files in ns-2.34 directory).
Download it from here.
The package is a complete ns-allinone-package with all changes done without the need of having u to make any further changes. If the following steps are followed in order u might get a full clean install of ns2.
Note : We shall install ns-2.34 in the home directory and no where else. So please copy the downloaded file in your home directory. And if u do not know where the home directory is u can google it 🙂 .
Step 1) Remove any previous ns2 versions installed on your OS
rm -rf /home/<your-homedirectory-name>/ns-allinone-2.34
instead of ns-allinone-2.34 u can put prior versions of ns2 if installed. And to find your home directory open terminal using Ctrl + Alt + T and then type pwd in it.
Step 2) After step 1, enter the following commands
sudo apt-get update
sudo apt-get install build-essential autoconf automake libxmu-dev libxt-dev libx11-dev xorg-dev xgraph gcc g++
The above command will install all necessary dependencies in order for ns-2.34 to run and install successfully.
Step 3) Now unzip the downloaded ns-allinone-2.34.tar.gz folder by right clicking on it and selecting open with archive manager and extract it in your home folder. Then open terminal using Ctrl + Alt + T.
Browse to the ns-allinone-2.34 directory by typing :
cd ns-allinone-2.34
now browse to ns-2.34 directory by typing :
cd ns-2.34
now type the following commands in order.
./configure
make clean
make depend
make
They should run successfully without showing any error. If you get any problems ask in comments.
Now go back to ns-allinone-2.34 directory by typing
cd ..
Now install ns-2.34 by typing
./install
It should install successfully. Now close the terminal by typing exit. If u get any errors ask in comments section.
Step 4) Now its time to setup your environment variables. This is the tricky part.
open terminal by pressing Ctrl + Alt + T. And enter the following command:
sudo gedit ~/.bashrc
bashrc file would open in gedit. At the end of the file add the following lines (Do it carefully)
# LD_LIBRARY_PATH
OTCL_LIB=/home/arya/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/arya/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/arya/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/arya/ns-allinone-2.34/bin:/home/arya/ns-allinone-2.34/tcl8.4.18/unix:/home/arya/ns-allinone-2.34/tk8.4.18/unix:/home/arya/ns-allinone-2.34/xgraph-12.1/
NS=/home/arya/ns-allinone-2.34/ns-2.34/
NAM=/home/arya/ns-allinone-2.34/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM
NOTE: change arya in the above paths to your home directory’s name. (DO NOT FORGET THAT).
Close the bashrc file. Log off and log in again.
Step 5) Now open terminal using Ctrl + Alt + T and type ns.
A % sign should appears and that marks a clean installation of ns-2.34.
Voila! Success.
In the next post, I shall write about configuring ns-2.34 in Eclipse (Galileo version) for development purposes and for modifying and compiling ns-2.34 from eclipse.
Pingback: [GUIDE TO] Configuring ns-2.34 with Eclipse Galileo in Ubuntu 12.04 | Researching Wirelessly
I got the following error when I run the “make” command
/bin/sh: 1: /home/salman-khalid/ns-allinone-2.34/bin/tclsh8.4: not found
make: *** [gen/version.c] Error 127
Please tell what I have to do?
rm -f gen/version.c
/home/salman-khalid/ns-allinone-2.34/bin/tclsh8.4 bin/string2c.tcl version_string gen/version.c
/bin/sh: 1: /home/salman-khalid/ns-allinone-2.34/bin/tclsh8.4: not found
make: *** [gen/version.c] Error 127
salman-khalid@ubuntu:~/ns-allinone-2.34/ns-2.34$
I am getting this error please help me.
Salman: The error that u are getting is related to my version of ns-2.34. My friends also got the same error. I suggest u downloading the ns-allinone-2.34 from ns2 website and installing it. In a certain post i would post all the changes that need to be made in ns-2.34 in order for it to compile successfully.
ok.. thanks…..
hai… i got an error with gcc compiler while installing ns2.34 in ubuntu 12.04 with above procedure.
the error is:
“””travelmate@ubuntu:~/Desktop/ns-allinone-2.34/ns-2.34$ ./configure
checking for gcc… gcc-4.7.2
checking for C compiler default output file name…
configure: error: in `/home/travelmate/Desktop/ns-allinone-2.34/ns-2.34′:
configure: error: C compiler cannot create executables
See `config.log’ for more details.”””
accepted any suggestions. thanks in advance
You just need to write a good article with keywords
which is related to your business. In opt in process, the pop up window
will appear when the user is about to go
away the promotional website. You can also offer a list of suggested pages they could view instead, or link to the home
page.
I get this error while installing. How can I resolove
4.a when searching for -ltcl8.4
/usr/bin/ld: cannot find -ltcl8.4
collect2: ld returned 1 exit status
make: *** [ns] Error 1
make: Circular tcp/linux/tcp_naivereno.c <- tcp/linux/tcp_naivereno.c dependency dropped.
i got this while installing ns2 ,someone help me regarding this
make: gcc-4.6: Command not found
make: *** [tcp/linux/tcp_naivereno.o] Error 127
someone please help remove these errors
configure: error: Installation of tcl seems incomplete or can’t be found automatically.
Please correct the problem by telling configure where tcl is
using the argument –with-tcl=/path/to/package
(perhaps after installing it),
or the package is not required, disable it with –with-tcl=no.
i have got this error while executing the ./configure command
/home/svce/ns-allinone-2.34/tk8.4.18/unix/tkUnixInit.c
In file included from /home/svce/ns-allinone-2.34/tk8.4.18/unix/../generic/tkInt.h:21:0,
from /home/svce/ns-allinone-2.34/tk8.4.18/unix/tkUnixInit.c:15:
/home/svce/ns-allinone-2.34/tk8.4.18/unix/../generic/tk.h:81:23: fatal error: X11/Xlib.h: No such file or directory
compilation terminated.
make: *** [tkUnixInit.o] Error 1
tk8.4.18 make failed! Exiting …
For problems with Tcl/Tk see http://www.scriptics.com
I GOT ERROR