Skip to content

How to Installing & Running LEACH on NS-2.34 (Step-by-Step)

This is my experience when I installed LEACH on NS-2.34 in my Ubuntu 10.04 LTS. After googling I found some useful links that discussing about how to running Leach on NS-2 as follows :

So here is my note when I install and run Leach on NS-2.34.
I suppose that you have already installed NS-2.34 on your Linux with the compiler gcc-4.3.
The home directory of my NS-2.34 is “/home/abdusy/ns-allinone-2.34”

  1. Download the package “ns-234-leach.tar.gz” into the directory “/home/abdusy/ns-allinone-2.34/ns-2.34”.
  2. Download the bash file “leach-setup.sh” into the directory “/home/abdusy/ns-allinone-2.34/ns-2.34”.
  3. If the home directory of your “NS-2.34” is other than “/home/abdusy/ns-allinone-2.34”, then you need to find “ns-allinone-2.34” and replace with “yourpath/ns-allinone-2.34” for the file “leach-setup.sh”.
  4. Move to the directory “/home/abdusy/ns-allinone-2.34/ns-2.34” and patch the file “leach-setup.sh” by run this command :
    • abdusy@ubuntu-10.04:~$ cd /home/abdusy/ns-allinone-2.34/ns-2.34/ 
    • abdusy@ubuntu-10.04:/home/abdusy/ns-allinone-2.34/ns-2.34$ bash leach-setup.sh
  5. If the home directory of your “ns-2.34” is other than “/home/abdusy/ns-allinone-2.34”, then you need to find “…/ns-allinone-2.34” and replace with “yourpath/ns-allinone-2.34” for the following two files:
    •  “Makefile” : found in the directory “/home/abdusy/ns-allinone-2.34/ns-2.34”.
    • “Makefile.in” : found in the directory “/home/abdusy/ns-allinone-2.34/ns-2.34”.
  6. Edit both “Makefile” & “Makefile.in” as following:
    • CC = gcc-4.3
    • CPP = g++-4.3
  7. Run the following commands
    • abdusy@ubuntu-10.04:/home/abdusy/ns-allinone-2.34/ns-2.34$ ./configure
    • abdusy@ubuntu-10.04:/home/abdusy/ns-allinone-2.34/ns-2.34$ make clean
    • abdusy@ubuntu-10.04:/home/abdusy/ns-allinone-2.34/ns-2.34$ make
    • If you have a problem while ‘make’ and shown error message like this : “trace/cmu-trace.cc: In member function ‘void CMUTrace::format(Packet*, const char*)’: trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope trace/cmu-trace.cc: At global scope: trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’ make: *** [trace/cmu-trace.o] Error 1”

then you need to add this lines into your cmu-trace.h:
// start from line 165
#ifdef MIT_uAMPS
void format_rca(Packet *p, int offset);
#define ADV_CHAR ‘A’
#define REQ_CHAR ‘R’
#define DATA_CHAR ‘D’

#endif

and also add this line into ns-default.tcl (line 765):

# ——————————————————
Phy/WirelessPhy set alive_ 1
Phy/WirelessPhy set Efriss_amp_ 100e-12
Phy/WirelessPhy set Etwo_ray_amp_ 0.013e-12

Phy/WirelessPhy set EXcvr_ 50e-9
Phy/WirelessPhy set sleep_ 0
Phy/WirelessPhy set ss_ 1
Phy/WirelessPhy set dist_ 0
# ——————————————————

After that, you need to re-make.
If the previous commands passed successfully then you are ready to test your “Leach” by running ./test:
abdusy@ubuntu-10.04:/home/abdusy/ns-allinone-2.34/ns-2.34$ ./test
Check the file “leach.err”, if no error is reported then go to “leach.out” and enjoy your results!

May, 16, 2012.

68 thoughts on “How to Installing & Running LEACH on NS-2.34 (Step-by-Step)”

  1. Hi Abdusy Syarif ,
    I successfully implemented leach protocol and also able to generate the leach.out, leach.tr and leach.data successfully.
    But there is no NAM file generated.
    I tried generating NAM output in LEACH but no luck.
    Can you pls help me for the same.

  2. Dear Author, Thanks for your post about patching LEACH. But the results given are wrong I feel, because it is giving results for 100 nodes which is actually 3 in wireless-demo-csci694.tcl. If you have any other tcl scripts to run LEACH please send to me or tell me how can I use LEACH just like AODV or DSR. My mail id is munivenkateshnitk@gmail.com

  3. Dear Author, i have installed gcc-4.4, g++-4.4 on my ubuntu 12.04 LTS with NS-2.34. Is it necessary to install gcc-4.3, g++-4.3 and make changes in Makefile and Makefile.in as stated above while I have changed it already stated by you as follows-
    Solved : Problem and Step-by-Step Installing NS-2.34 On Ubuntu 12.04 LTS
    STEP 8 : ~$ gedit /home/abdusy/ns-allinone-2.34/ns-2.34/Makefile.in
    SOLVED:
    #CC = @CC@
    #CPP = @CXX@
    CC = @CC@-4.4
    CPP = @CXX@-4.4
    STEP 9 : ~$ gedit /home/abdusy/ns-allinone-2.34/ns-2.34/Makefile
    SOLVED:
    #CC = gcc
    #CPP = g++
    CC = gcc-4.4
    CPP = g++-4.4
    May you add me sir on your e-mail id?

  4. Dear Author, I am not able to generate leach.nam (NAM File) for this. However i am able to generate leach.out successfully. Please help me. How to generate leach.nam ?

  5. i hv executed the leach code..bt i jus dun understand how cn i find dat leach code hs been successfully executed…i hv found in leach.err file that sorting hs done…ns exiting…so tell me how cn i chk my code hs been executed…and how cn i see nam file nd xgrph of leach code..kindly tell me……….

  6. sir…when i type make…i got this…
    make[1]: Entering directory `/home/pranavi/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/dec’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/home/pranavi/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/dec’
    what does it mean???
    sir i m executing this code on ns 2.34 with gcc 4.4…plz solve my pblm..

  7. heloo author
    i am not able to generate nam file for leach protocol.please provide me help to generate nam for same

  8. tinwinmawutycc@gmail.com

    Dir Author ,
    sir…when i type make…i got this…
    make[1]: Entering directory `/home/pranavi/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/dec’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/home/pranavi/ns-allinone-2.34/ns-2.34/indep-utils/webtrace-conv/dec’
    what does it mean???
    sir i m executing this code on ns 2.34 with gcc 4.4…plz solve my pblm..

  9. I am using ns2.35 and ubuntu 12.04 along with gcc version 4.6.3 downloaded the ns-234-leach.tar.gz package and followed instructions given on the forums.
    This is the error i get after “make”.
    mac/ll.cc:244:13: error: redefinition of ‘void LL::hdr_dst(Packet*, int)’
    ./mac/ll.h:99:22: error: ‘virtual void LL::hdr_dst(Packet*, int)’ previously defined here
    make: *** [mac/ll.o] Error 1
    Im doing this on ns2.35 and not ns2.34. I’ve followed the instructions for installations on ns2.34…. Should I be making any alterations??
    Please help.

    1. Hello Siva,
      I am facing the same problem as yours. Did you manage to solve it? If yes can you please tell me how?
      Many thanks!
      Imy

  10. I followed the same steps given above but after “make” i am getting the following error.
    i am using gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)
    i tried with g++4.6.3, g++4.6.3-201220306, g++4.6 all are giving the same error.
    g++-4.6 -c -Wall -Wno-write-strings -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_13 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCLINT_H -DHAVE_TCL_H -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=std -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -DMIT_uAMPS -I. -I. -I/home/hemanth/ns-allinone-2.34/tclcl-1.19 -I/home/hemanth/ns-allinone-2.34/otcl -I/home/hemanth/ns-allinone-2.34/include -I/home/hemanth/ns-allinone-2.34/include -I/home/hemanth/ns-allinone-2.34/include -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -I./mit/rca -I./mit/uAMPS -o tools/random.o tools/random.cc
    make: g++-4.6: Command not found
    make: *** [tools/random.o] Error 127
    please help me.

  11. Hello sir, I get the following error when i execute my leach tcl
    ns: _o1466 send_now 0xffffffff 1 1 60 16 1: wrong # args: should be “_o1466 self class proc mac_dst link_dst type msg data_size dist code”
    (Application/LEACH send_now line 1)
    invoked from within
    “_o1466 send_now 0xffffffff 1 1 60 16 1”
    please help me.

  12. Nice instructions…
    Sir, I’ve successfully installed LEACH but it shows more energy that the total energy in leach.out. how can i remove this error?
    Thanks…

  13. hj.
    help me.
    ( line 165
    // This holds all the tracers added at run-time
    static PacketTracer *pktTrc_;#ifdef MIT_uAMPS
    void format_rca(Packet *p, int offset);
    #define ADV_CHAR ‘A’
    #define REQ_CHAR ‘R’
    #define DATA_CHAR ‘D’
    #endif
    )
    end
    (line 765
    Phy/WirelessPhyExt set CSThresh_ 6.30957e-12 ;# ——————————————————
    Phy/WirelessPhy set alive_ 1
    Phy/WirelessPhy set Efriss_amp_ 100e-12
    Phy/WirelessPhy set Etwo_ray_amp_ 0.013e-12
    Phy/WirelessPhy set EXcvr_ 50e-9
    Phy/WirelessPhy set sleep_ 0
    Phy/WirelessPhy set ss_ 1
    Phy/WirelessPhy set dist_ 0
    # ——————————————————# -82 dBm
    )
    true or false

  14. hi dear sir
    i have download a tcl file for using leach it containg flowing comannand:
    getopt $argc $argv
    when i try to ns leach.tcl it fail.
    have you any tcl file that use leach?

  15. I followed the same steps given above but after “make” i am getting the following error.
    I am working with Red Hat Enterprise Linux-5
    i tried with g++4.3,
    g++-4.3 -c -Wall -Wno-write-strings -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_13 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCLINT_H -DHAVE_TCL_H -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=std -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -DMIT_uAMPS -I. -I. -I/home/hemanth/ns-allinone-2.34/tclcl-1.19 -I/home/hemanth/ns-allinone-2.34/otcl -I/home/hemanth/ns-allinone-2.34/include -I/home/hemanth/ns-allinone-2.34/include -I/home/hemanth/ns-allinone-2.34/include -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -I./mit/rca -I./mit/uAMPS -o tools/random.o tools/random.cc
    make: g++-4.3: Command not found
    make: *** [tools/random.o] Error 127
    please help me.

  16. thanks sir for a nice steps.i want to learn the working of leach code .kindly guide for that.. After leach installation,which folder contains source code?Thanks

  17. hello sir,
    i hv installed ns-2.34 in ubuntu 12.04 as well as leach protocol bt i am unable to modify it; nt even no. of nodes.
    i am looking forward to modify leach algorithm to make it more energy efficient by introducing another energy threshold level before the node die.
    thanks a lot…ur blog helped me a lot!
    please reply !!

  18. 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:)

    1. Hi Eli,
      Even I am having same problem in Ubuntu 12.04. While tracing LEACH code I found that It calculates ad_adv_total. The calculation is shown in uamps/sims/leach.tcl and uamps/sim/uamps.tcl. The fact which I have observed is, even though the expression is adding 1 to some calculated value, the function returns value which is less than 1.0. If i try to place function in ns-leach.tcl , then value shows with 1.004871. Since nodes are not able to wait until it gets all the ADV from CH, the error is coming.
      But I was not able to figure out why 1 does not get added when function is calculated in sims/uamps. I am still analysing the issue. If some one is able to analyse , then it will be big help for all who would like run LEACH on ubuntu 12.04 with gcc-4.4.

  19. I am trying to run leach protocol on ns2.34 using ubuntu 10.04 as platform.
    I get an error when i try to execute the code leach_test, after entering the right path (/home/shaftri/ns-allinone-2.34/ns-2.34/ns-234-leach/)
    i give the command ./leach_test i get the error in the file leach.err as this
    couldn’t read file “tcl/lib/ns-mobilenode.tcl”: no such file or directory
    while executing
    “source.orig tcl/lib/ns-mobilenode.tcl”
    (“uplevel” body line 1)
    invoked from within
    “uplevel source.orig[list $fileName]”
    invoked from within
    “if [$instance_ is_http_url $fileName] {
    set buffer [$instance_ read_url $fileName]
    uplevel eval $buffer
    } else {
    uplevel source.orig[list $fileName]
    …”
    (procedure “source” line 8)
    invoked from within
    “source tcl/lib/ns-mobilenode.tcl”
    (file “tcl/ex/wireless.tcl” line 184)
    Which is this file mobilenode.tcl which has been referred to ?? i tried running the file “test” also but i get the error as this:
    couldn’t read file “wireless-demo-csci694.tcl”: no such file or directory
    Why does this happen?? And how can i get the nam to run for leach protocol.
    Please guide me as i am a little confused about how to get the outputs .
    Regards
    shaftri

    1. Hi , i have the same error :
      couldn’t read file “tcl/lib/ns-mobilenode.tcl”: no such file or directory
      while executing
      “source.orig tcl/lib/ns-mobilenode.tcl”
      (“uplevel” body line 1)
      invoked from within
      “uplevel source.orig [list $fileName]”
      invoked from within
      “if [$instance_ is_http_url $fileName] {
      set buffer [$instance_ read_url $fileName]
      uplevel eval $buffer
      } else {
      uplevel source.orig [list $fileName]
      …”
      (procedure “source” line 8)
      invoked from within
      “source tcl/lib/ns-mobilenode.tcl”
      (file “tcl/ex/wireless.tcl” line 184)
      Can you help me.Thanks very much.my email is echoukairi ATgmail.com

  20. Hi eli and Geetha,
    I have the same error like eli.
    I installed LEACH 2.34 in ubuntu12.04 with gcc4.4 successfully.
    I want to know how to work with leach.out file and leach.tr file.
    I want to plot graph for average energy consumption, network lifetime and load balancing…etc..
    I didn’t have any knowledge that how to get this all results. Plz help me.my email is echoukairi@hotmail.fr
    Thank you very much

  21. Hi abdusy syarif,
    I installed leach in nS2.34 on ubuntu 12.10 succefully.But :
    1- when I type: ns ns-leach.tcl, it gives me: OK, no error
    2- When I type ns leach.tcl, it gives me this error:
    leach@leach-ns2:~/ns2/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims$ ns leach.tcl
    can’t read “opt(num_clusters)”: no such element in array
    while executing
    “expr 1.5*$opt(num_clusters)”
    invoked from within
    “expr int([expr 1.5*$opt(num_clusters)])+1”
    invoked from within
    “set opt(spreading) [expr int([expr 1.5*$opt(num_clusters)])+1]”
    (file “leach.tcl” line 13)
    in leach.err: no error
    in leach.out , it give me :
    Node 94 is DEAD!!!!
    Node 95 is DEAD!!!!
    At 1.0999999999999999:
    Total Energy = 29813.620401289838
    Total Data = 0
    Total Alive = 4
    Simulation complete.
    num_nodes is set 101
    channel.cc:sendUp – Calc highestAntennaZ_ and distCST_
    highestAntennaZ_ = 1.5, distCST_ = 214.8
    Please help me,my mail is : echoukairi@gmail.com. i dont understand where is the error??

  22. hello everyone i tried to install ns allinone 2.35 in ubuntu 14.04 when i tried to exexcute ./configure command i have got the following error :
    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.
    please help ne out

  23. Hello sir,
    I want to simulate leach in NS2.35. And i have installed ns2.35 in ubuntu14.04 and mannasim in it. Further for simulation of leach protocol what steps should i followed?

  24. hello sir,
    I have installed ns2.35 in ubuntu and mannasim in it. i want to simulate leach routing protocol. for this what steps should i followed?

  25. I have installed ns2.35 in ubuntu and mannasim in it. i want to simulate leach routing protocol. please help me what’s the steps i can do?thank you

  26. Hello sir, i am getting an error after the command ./configure as:
    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.
    and even after typing ./configure –with-tcl-ver=8.5 am getting the same error. Please help me out

  27. hello everybody
    Can you help me?
    I allowed step but when i run propram ./test -> bash: ./test: No such file or directory.

  28. INITIALIZE THE LIST xListHead
    *** NOTE: no connection pattern specified.
    Loading scenario file…
    couldn’t read file “../mobility/scene/scen-670×670-50-600-20-2”: no such file or directory
    while executing
    “source.orig ../mobility/scene/scen-670×670-50-600-20-2”
    (“uplevel” body line 1)
    invoked from within
    “uplevel source.orig [list $fileName]”
    invoked from within
    “if [$instance_ is_http_url $fileName] {
    set buffer [$instance_ read_url $fileName]
    uplevel eval $buffer
    } else {
    uplevel source.orig [list $fileName]
    …”
    (procedure “source” line 8)
    invoked from within
    “source $opt(sc)”
    invoked from within
    “if { $opt(sc) == “” } {
    puts “*** NOTE: no scenario file specified.”
    set opt(sc) “none”
    } else {
    puts “Loading scenario file…”
    source $op…”
    (file “tcl/ex/wireless.tcl” line 294)
    HELP ME FIX ERROR! PLEASE

  29. im trying to install leach in ns2.34 and i added the code in ns-default.tcl and cmu-trace
    even though i getting this error
    trace/cmu-trace.cc:1532: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\230’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\231’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\230’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\231’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\230’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\231’ in program
    trace/cmu-trace.cc: In member function ‘void
    CMUTrace::format_rca(Packet*, int)’:
    trace/cmu-trace.cc:1532: error: ‘A’ was not declared in this scope
    trace/cmu-trace.cc:1536: error: ‘R’ was not declared in this scope
    trace/cmu-trace.cc:1540: error: ‘D’ was not declared in this scope
    make: *** [trace/cmu-trace.o] Error 1

  30. im trying to install leach protocol in ns2.34 but im getting this error.
    trace/cmu-trace.cc:1532: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\230’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1532: error: stray ‘\231’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\230’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1536: error: stray ‘\231’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\230’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\342’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\200’ in program
    trace/cmu-trace.cc:1540: error: stray ‘\231’ in program
    trace/cmu-trace.cc: In member function ‘void
    CMUTrace::format_rca(Packet*, int)’:
    trace/cmu-trace.cc:1532: error: ‘A’ was not declared in this scope
    trace/cmu-trace.cc:1536: error: ‘R’ was not declared in this scope
    trace/cmu-trace.cc:1540: error: ‘D’ was not declared in this scope
    make: *** [trace/cmu-trace.o] Error 1

  31. Hello Sir,
    I have installed ns-2.35 and mannasim. Is the version of leach you presented here compatible with the current version of ns2?

  32. Thanks for valuable code of Leach in NS-2. Everything installed fine ns-2.35 and ns-leach-2.35. Problem come when run leach_test file passes higher number of command line arguments as compared to wireless.tcl script. thus it is not function. For example topo is not command line argument in wireless.tcl. Pl. rectify the problem ASAP. and send solution to email.
    thanks

  33. tINITIALIZE THE LIST xListHead
    *** NOTE: no connection pattern specified.
    Loading scenario file…
    can’t read “opt(topo)”: no such element in array
    while executing
    “open $opt(topo) r”
    invoked from within
    “set filename [open $opt(topo) r]”
    (file “mit/uAMPS/sims/nodescen” line 3)
    invoked from within
    “source.orig mit/uAMPS/sims/nodescen”
    (“uplevel” body line 1)
    invoked from within
    “uplevel source.orig [list $fileName]”
    invoked from within
    “if [$instance_ is_http_url $fileName] {
    set buffer [$instance_ read_url $fileName]
    uplevel eval $buffer
    } else {
    uplevel source.orig [list $fileName]
    …”
    (procedure “source” line 8)
    invoked from within
    “source $opt(sc)”
    invoked from within
    “if { $opt(sc) == “” } {
    puts “*** NOTE: no scenario file specified.”
    set opt(sc) “none”
    } else {
    puts “Loading scenario file…”
    source $op…”
    (file “tcl/ex/wireless.tcl” line 294)
    [root@localhost ns-2.35]#
    [root@localhost ns-2.35]# ns tcl/ex/wireless.tcl
    Usage: tcl/ex/wireless.tcl
    mandatory arguments:
    [-x MAXX] [-y MAXY]
    optional arguments:
    [-cp conn pattern] [-sc scenario] [-nn nodes]
    [-seed seed] [-stop sec] [-tr tracefile]
    how to pass parameters for topo, and others as they are not in wireless.tcl script.

  34. maaf pak sebelumnya sy telah configurasi Makefile dan Makefile.in tapi errornya disini pak setelah saya ketik “./Configure”
    ##################
    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.
    ############################

  35. Hi team. I try to install LEACH on NS2.35 in Ubuntu 18.04 LTS but I get this error message:
    make: *** Aucune règle pour fabriquer la cible « mit/rca/rcagent.c », nécessaire pour « mit/rca/rcagent.o ». Arrêt.
    Ns make failed!
    Someone can help me to solve that?

      1. Bonjour,
        Thanks for your feedback!
        Perhaps the Makefile.in issue but I tried to adapt by changing gcc/g++-4.1/4.4 compiler version but nothing!
        Someone has another idea to get solve?

Leave a Reply

Your email address will not be published. Required fields are marked *