Jan 2, 2012

Install ns2.34 on Ubuntu 10.04

1) Download ns2.34 allinone package from http://sourceforge.net/projects/nsnam/files%2Fallinone%2Fns-allinone-2.34/

2) Uncompress to your own directory by using command "tar -zvxf ns-allinone-2.34.tar.gz"

3) Install some development files,

sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrade

sudo apt-get install build-essential

sudo apt-get install libc6-dev g++ gcc-4.3

sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev

sudo apt-get install autoconf automake libxmu-dev libxmu-headers

4) Then,

$cd ns-allinone.2.34/


5) If got "otcl-1.13 make failed! Exiting" error,
i)edit the configure.in file in otcl-1.13, Line77 SHLIB_LD="ld -shared" -> SHLIB_LD="gcc -shared"
ii)edit the configure file in otcl-1.13, Line6304 SHLIB_LD="ld -shared" -> SHLIB_LD="gcc -shared"

6) Edit otcl-1.13/Makefile.in,

CC= @CC@ -> CC= gcc-4.3

7) Then,

$cd ns-allinone.2.34/


8) If got an error like

"`.gnu.linkonce.t._ZN11taskPending10taskStatusEh' referenced in section `.rodata' of wpan/p802_15_4mac.o: defined in discarded section `.gnu.linkonce.t._ZN11taskPending10taskStatusEh' of wpan/p802_15_4mac.o
collect2: ld returned 1 exit status
make: *** [ns] error 1"

, that is because you are using gcc3.3 to compile it. And you have to change gcc compiler version to gcc4 or above.

9) Then, it should work. Finally, dont forget to modify .bashrc file to add environment variables.

export PATH=$PATH:/YOURDIR/ns-allinone-2.34/bin:/YOURDIR/ns-allinone-2.34/tcl8.4.18/unix:/YOURDIR/ns-allinone-2.34/tk8.4.18/unix

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/YOURDIR/ns-allinone-2.34/otcl-1.13:/YOURDIR/ns-allinone-2.34/lib

export TCL_LIBRARY=$TCL_LIBRARY:/YOURDIR/ns-allinone-2.34/tcl8.4.18/library


  1. problem in installing NAM1.14
    please help urgently

    1. Hi Pranali,

      Could you please describe your problem?

  2. what problem u r facing

  3. Hi,i have problems installing ns2.35 in ubuntu 10.04
    can u pl help me out,
    ns is not running in terminal,all other procedures worked,the last step is not working,
    help me out,
    thanks in advance

    1. hi, is it possible to post some error msgs so that we can know the problem?

  4. Dear Sir,
    While installing gcc-4.3 it shows me an error.

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Package gcc-4.3 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package 'gcc-4.3' has no installation candidate

    1. Which way you install it? Using apt-get install? If yes, probably, the gcc is not in your system resource list.