Installing ns-2.34 on Ubuntu 11.10 Oneiric Ocelot

This is almost identical to the way ns-2.34 is installed on Ubuntu 11.04, except for the lines in bold face:

Install the development files for X Windows plus the g++ compiler:
sudo apt-get install xorg-dev g++ xgraph

Fix the error in the linking of otcl by editing line 6304 of otcl-1.13/configure so that it reads
SHLIB_LD="gcc -shared"
instead of
SHLIB_LD="ld -shared"

Then, edit the file ns-2.34/tools/ranvar.cc and change the line 219 from
return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
to
return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

Next, change the lines 183 and 185 in file ns-2.34/mobile/nakagami.cc to read
resultPower = ErlangRandomVariable(Pr/m, int_m).value();
and
resultPower = GammaRandomVariable(m, Pr/m).value();

Add a line after line 64 in ns-2.34/mac/mac-802_11Ext.h to read:
#include <stddef.h>

Now the code will compile if you run ./install. However, you may not be able to run the ns executable. If you get an error stating that there has been a buffer overflow *** buffer overflow detected ***: ./ns terminated including a backtrace, you need to do the following to make it work:

Install gcc-4.4 and g++-4.4 including dependencies using the code below:
$ sudo apt-get install gcc-4.4 g++-4.4

Change the line 270 in tcl8.4.18/unix/Makefile.in that reads
CC = @CC@
so it uses gcc version 4.4:
CC = gcc-4.4

Finally, run ./install from the ns-allinone-2.34 top folder again.

P.S. If you are moving and renaming ns-2 folders as time goes by, check the tip here on a potential problem with tk.

About these ads

40 thoughts on “Installing ns-2.34 on Ubuntu 11.10 Oneiric Ocelot

  1. Pingback: Installing ns-2.34 on Ubuntu 11.04 « Erlend's Lookout Post

  2. Pingback: Installing ns-2.34 on Ubuntu 10.10 « Erlend's Lookout Post

  3. Pingback: 在ubuntu11.10上编译安装NS-allinone-2.34

  4. Ritu

    hey.. very nice description..but when i followed all these steps i am getting the following error.

    Warning: tclStubInit.c may be out of date.
    Developers may want to run “make genstubs” to regenerate.
    This warning can be safely ignored, do not report as a bug!
    Installing libtcl8.4.a to /home/ranjita/ns-allinone-2.34/lib/
    cp: cannot create regular file `/home/ranjita/ns-allinone-2.34/lib/#inst.10843#': Permission denied
    rm: cannot remove `/home/ranjita/ns-allinone-2.34/lib/libtcl8.4.a': Permission denied
    mv: cannot stat `/home/ranjita/ns-allinone-2.34/lib/#inst.10843#': No such file or directory
    ranlib: could not create temporary file whilst writing archive: No more archived files
    make: *** [install-binaries] Error 1
    tcl8.4.18 installation failed.
    Tcl is not part of the ns project.

    Please help me out.. need to install it urgently..

    Reply
  5. mohandass

    Hi sir, How i solve this error…………….
    I have installed ns2(ns-allinone-2.34) in ubuntu11.10 .. At time of
    execution it’s showing some error like u installed tcl8.5 package th
    need is exactly tc18.4 only like that.

    Error is

    : version conflict for package “Tcl”: have 8.5.10, need exactly 8.4
    while executing
    “package require -exact Tcl 8.4″
    child process exited abnormally

    i cannn’t execute nam animatorr sir while i try to execute this error is come plz help ……

    Reply
  6. mohandass

    how i solve this error
    I have installed ns2(ns-allinone-2.34) in ubuntu11.10 .. At time of
    execution it’s showing some error like u installed tcl8.5 package th
    need is exactly tc18.4 only like that.

    Error is

    : version conflict for package “Tcl”: have 8.5.10, need exactly 8.4
    while executing
    “package require -exact Tcl 8.4″
    child process exited abnormally

    Reply
    1. Ayappan

      have you installed ns2 using the command “sudo spt-get install ns2 nam xgraph “? IF it…first uninstall ns2.34 and “nam”(important) from the system …install ns2.35 from sourceforge

      Reply
  7. arasu

    Hi, when I run the code i faced following error. pls help me..

    make: Warning: File `Makefile.in’ has modification time 1.9e+07 s in the future
    Makefile.in is newer than Makefile.
    You need to re-run configure.
    false
    make: *** [Makefile] Error 1
    Ns make failed!

    Reply
  8. arasu

    Hi i faced following error. kindly guide me…

    gcc -c -g -O2 -DNDEBUG -DUSE_SHM -fpic -I. -I/home/sesho/ns-allinone-2.34/include -I/home/sesho/ns-allinone-2.34/include -I/home/sesho/ns-allinone-2.34/include -I/include otcl.c
    ld -shared -o libotcl.so otcl.o
    otcl.o: In function `OTclDispatch':
    /home/sesho/ns-allinone-2.34/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local’
    otcl.o: In function `Otcl_Init':
    /home/sesho/ns-allinone-2.34/otcl-1.13/otcl.c:2284: undefined reference to `__stack_chk_fail_local’
    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 …

    Reply
      1. sana

        re,
        I forgot to do these first instructions:
        Install the development files for X Windows plus the g++ compiler:
        sudo apt-get install xorg-dev g++ xgraph

        Fix the error in the linking of otcl by editing line 6304 of otcl-1.13/configure so that it reads
        SHLIB_LD=”gcc -shared”
        instead of
        SHLIB_LD=”ld -shared”

        Once I did I could fix this problem.

  9. gowtham

    I have installed Ns-2.34 on Ubuntu 11.10, but when I tried to run

    $ ns example1a.tcl

    i got

    nam:

    : version conflict for package “Tcl”: have 8.5.10, need exactly 8.4
    while executing
    “package require -exact Tcl 8.4″

    Can you please help me to solve this problem

    Reply
  10. Pingback: NS2 v2.26 installation on Ubuntu 11.10

  11. vinod

    “nam command is not working” , i am using ubuntu 11.04 and i am able run tcl file using ns command but nam dont work plz help, thanks

    Reply
  12. Larissa

    Hi, I am using ubuntu 11.10 and I’m trying to install ns-3.9. I can’t build ns-3. It keeps giving me the error:

    Build failed: -> task failed (err #1):
    {task: cxx buffer.cc -> buffer_1.o}
    Traceback (most recent call last):
    File “./build.py”, line 117, in
    sys.exit(main(sys.argv))
    File “./build.py”, line 108, in main
    build_ns3(config)
    File “./build.py”, line 56, in build_ns3
    run_command(["python", "waf"])
    File “/home/larissa/repos/ns-allinone-3.9/util.py”, line 24, in run_command
    raise CommandError(“Command %r exited with code %i” % (argv, retval))
    util.CommandError: Command ['python', 'waf'] exited with code 1

    I really would appreciate any help!

    Thanks,

    Larissa.

    Reply
  13. Pingback: how to integrate the "Resource/Energy" leach class into NS-2.34? - Page 17

  14. Pingback: Unable to install ns2.34 on ubuntu 11.10

  15. Pingback: SPIN and LEACH protocol in NS-2

  16. Pingback: NS2.34 error in Ubuntu 12.04 LTS

  17. Pingback: network simulator 2.34

  18. Pingback: Installing ns-2.34 on ubuntu 12.04 | amitcode

  19. eli

    hi all
    I installed ns2 in ubuntu 12.04 and run leach on it without any error(I fixed them)
    but there is no valid output I think, I saw this problem later that no one know it.
    can any one help me where is the problem?

    http://www.4shared.com/file/iEc3lORcba/leach.html

    Creating sensor nodes…
    0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 (100 == BS)
    *** NOTE: no connection pattern specified.
    Loading scenario file…
    Node 0: (65.745973803916002,92.581722416254564)
    Node 1: (21.008649990432268,92.380389195112684)
    Node 2: (37.201202259027028,40.606367467253641)
    Node 3: (71.218022131928251,61.297971318148988)
    Node 4: (35.003944130150579,11.288995440718249)
    Node 5: (34.146372151629237,98.076752432657756)
    .
    .
    .
    Node 99: (44.071560420129238,10.71598111219517)
    Max Distance for this Simulation is 139.0
    Load complete…
    Starting Simulation…
    THRESH = 0.050000000000000003
    0: *******************************************
    THRESH = 0.050000000000000003
    1: *******************************************
    THRESH = 0.050000000000000003
    2: *******************************************
    THRESH = 0.050000000000000003
    3: *******************************************
    THRESH = 0.050000000000000003
    4: *******************************************
    THRESH = 0.050000000000000003
    5: *******************************************
    THRESH = 0.050000000000000003
    .
    .
    .

    THRESH = 0.050000000000000003
    99: *******************************************
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    0: Warning!!! No Cluster Head ADVs were heard!
    Data being sent to the Base Station
    Data was sent to the base station
    1: Warning!!! No Cluster Head ADVs were heard!
    Data being sent to the Base Station
    Data was sent to the base station
    2: Warning!!! No Cluster Head ADVs were heard!
    Data being sent to the Base Station
    Data was sent to the base station
    3: Warning!!! No Cluster Head ADVs were heard!
    Data being sent to the Base Station
    Data was sent to the base station
    4: Warning!!! No Cluster Head ADVs were heard!
    Data being sent to the Base Station
    Data was sent to the base station
    .
    .
    .
    99: Warning!!! No Cluster Head ADVs were heard!
    Data being sent to the Base Station
    Data was sent to the base station
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    .
    .
    .
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
    Use dst_addr_ and dst_port_ instead
    Warning! There are no nodes in this cluster (11)!
    Data being sent to the Base Station
    Data was sent to the base station
    Warning! There are no nodes in this cluster (26)!
    Data being sent to the Base Station
    Data was sent to the base station
    .
    .
    Node 0 is DEAD!!!!
    Node 1 is DEAD!!!!
    Node 2 is DEAD!!!!
    Node 3 is DEAD!!!!
    Node 4 is DEAD!!!!
    Node 5 is DEAD!!!!
    .
    .
    .
    Node 94 is DEAD!!!!
    Node 95 is DEAD!!!!

    At 1.0999999999999999:
    Total Energy = 30125.543246939353
    Total Data = 0
    Total Alive = 4

    Simulation complete.

    num_nodes is set 101
    channel.cc:sendUp – Calc highestAntennaZ_ and distCST_
    highestAntennaZ_ = 1.5, distCST_ = 222.8

    as we see , at end Total data is 0 and all of the nodes dead!!!
    help plsss:)

    Reply
  20. Pingback: ns2 version-2.34 is too old-wpan-802.15.4

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s