LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-21-2015, 12:36 PM   #1
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Rep: Reputation: Disabled
Error in LEACH implementation


I have installed Ns2.34 in centos and try to implement LEACH protocol in it. I have installed ns-234-leach.tar.gz in /home/centos/Desktop/NS2/ns-allinone-2.34/ns-2.34 and past leach-setup.sh also in it. I get error in leach.err given below. I tried to change path in ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/uamps.tcl it not give permission to do any change.

can't read "env(RCA_LIBRARY)": no such variable
while executing
"source $env(RCA_LIBRARY)/ns-ranode.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 9)
invoked from within
"source.orig mit/uAMPS/sims/uamps.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 mit/uAMPS/sims/uamps.tcl"
(file "tcl/mobility/leach.tcl" line 18)
invoked from within
"source.orig tcl/mobility/leach.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/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)

Last edited by Rizwanamalek; 02-21-2015 at 01:35 PM.
 
Old 02-21-2015, 12:46 PM   #2
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 282

Rep: Reputation: 30
Try ./leach-setup.sh
 
Old 02-21-2015, 02:08 PM   #3
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
I have done this step

1. Download ns-234-leach.tar.gz. Keep this in your /home/path/ns-allinone-2.34/ns-2.34.
2.Download the bash file "leach-setup.sh" into the directory " /home/path/ns-allinone-2.34/ns-2.34".
leach-sh
3- Move to the directory "/home/path/ns-allinone-2.34/ns-2.34" and patch the file "leach-setup.sh"
just write$ bash leach-setup.sh

4- Now you need to edit Makefile.in and Makefile. Go to /home/$username/ns-allinone-2.34/ns-2.34 where you will find these files
CC = gcc-4.3
CPP = g++-4.3(Not necessary. I did not need to )

#####no permission to editing files Makefile.in and Makefile so i get same error, what i have to do?
 
Old 02-22-2015, 04:55 AM   #4
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
give me step for implementing LEACH protocol in ns2.34 in centos.
 
Old 02-22-2015, 05:26 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,518

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Example here, CentOS 6 ...
#2 http://www.linuxquestions.org/questi...-4175524367/#2
#3 http://www.linuxquestions.org/questi...-4175524367/#3

The old year 2011 instructions ...
#5 http://www.linuxquestions.org/questi...34-a-870368/#5
... that you refer to in post #3, are difficult to use →
Lots of editing to do.
Easier to use the new files, already edited by @exidus :
leach+pegasis-ns234-files-2.tar.gz
#289 http://www.linuxquestions.org/questi...68/page20.html


-
 
Old 02-22-2015, 07:27 AM   #6
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
I have done changes in make and make.in file.Done changes in bold faces.1]But in make file not allowed changes. It not show save option active after changes. 2]Is there any other text that i have forget to replace? Changes is done only on this two lines only. Because of that i get the error after make command

error#################

make: gcc-4.3: Command not found
make: *** [tcp/linux/tcp_naivereno.o] Error 127
[root@localhost ns-2.34]#


make.in
CC = @CC@ #######changed with gcc-4.3
CPP = @CXX@
LINK = $(CPP)
LINK_SHLIB = @SHLIB_LD@
MKDEP = ./conf/mkdep
TCLSH = @V_TCLSH@
TCL2C = @V_TCL2CPP@
AR = ar rc $(BLANK)

make

CC = gcc
#######3changed with gcc-4.3
CPP = g++
LINK = $(CPP)
LINK_SHLIB = gcc -shared
MKDEP = ./conf/mkdep
TCLSH = /home/centos/Desktop/NS2/ns-allinone-2.34/bin/tclsh8.4
TCL2C = ../tclcl-1.19/tcl2c++
AR = ar rc $(BLANK)
 
Old 02-22-2015, 07:38 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,518

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
← ref. #6.
Quote:
make: gcc-4.3: Command not found
See post #5 : Not valid any more.
`gcc-4.3´ was usable in Ubuntu 10.** until about 'June 2011'.

Year 2015 : Now we use gcc-4.4 :
$ ./install ( If CentOS 6, which has gcc / g++ version 4.4.x by default.)


-
 
Old 02-22-2015, 08:10 AM   #8
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
I have done according to post #5 suggested by you. I check my gcc virson is gcc-4.4.7.So i have done changes in make and make.in file as per post #5.But i have still have error at step 7 in make command.I can`t under stand what is wrong?

###########Suggested post #5 ###########
I suppose that ns-2.34 is installed with the compiler gcc-4.3.
The home directory of ns-2.34 is "/opt/ns-allinone-2.34"
1- download the package "ns-234-leach.tar.gz" into the directory "/opt/ns-allinone-2.34/ns-2.34".
https://docs.google.com/uc?id=0BzLWx...CNWG1NQK&hl=en
2- download the bash file "leach-setup.sh" into the directory "/opt/ns-allinone-2.34/ns-2.34".
https://docs.google.com/uc?id=0BzLWx...CJSU5ZYG&hl=en
3- If the home directory of your "ns-2.34" is other than "/opt/...", then you need to find "/opt/ns-allinone-2.34" and replace with "yourpath/ns-allinone-2.34" for the file "leach-setup.sh".
4- move to the directory "/opt/ns-allinone-2.34/ns-2.34" and patch the file "leach-setup.sh"
wsn@ubuntu:~$ cd /opt/ns-allinone-2.34/ns-2.34/
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$ bash leach-setup.sh
5- If the home directory of your "ns-2.34" is other than "/opt/...", then you need to find "/opt/ns-allinone-2.34" and replace with "yourpath/ns-allinone-2.34" for the follwoing two files:
- "Makefile" : found in the directory "yourpath/ns-allinone-2.34/ns-2.34".
- "Makefile.in" : found in the directory "yourpath/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
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$./configure
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$make clean
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$make
##############Error################
make: gcc-4.4.7: Command not found
make: *** [tcp/linux/tcp_naivereno.o] Error 127
[root@localhost ns-2.34]#
 
Old 02-22-2015, 09:51 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,518

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
← ref. #8.
Quote:
I have done according to post #5 suggested by you.
Not recommended. Not suggested by me. See the above posts #5 and #7 :
Not valid any more.

Not usable as is. Outdated.
And no reason to copy the old text into a posts here.
A link would do. See the above post #5 ...
http://www.linuxquestions.org/questi...-4175534720/#5

* The suggestion is ``leach+pegasis-ns234-files-2.tar.gz´´ !


-

Last edited by knudfl; 02-23-2015 at 01:14 AM.
 
Old 02-22-2015, 11:48 AM   #10
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
In both path shows given Outpt, this means Leach is installed properly?
path for ns-allinone-2.34 /home/centos/Desktop/NS2/ns-allinone-2.34/ns-2.34/mit/leach_sims

path for ns-234-leach.tar.gz /home/centos/Desktop/NS2/ns-allinone-2.34/ns-234-leach/mit/leach_sims

########leach.err
INITIALIZE THE LIST xListHead
SORTING LISTS ...DONE!

###########leach.out
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) cont.....
 
Old 02-22-2015, 02:30 PM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,518

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
← ref. #10.

Please compare with the output examples here, post #4 :
http://www.linuxquestions.org/questi...-4175531395/#4
 
Old 02-22-2015, 09:27 PM   #12
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
IN leach.out file is show some error like this how to reolve it?

################################################
97: Is a cluster head at time 0
THRESH = 0.050000000000000003
98: *******************************************
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
0: Current cluster-head is 35, code is 1, dist is 32
1: Current cluster-head is 97, code is 3, dist is 16
2: Current cluster-head is 74, code is 2, dist is 15
3: Current cluster-head is 35, code is 1, dist is 35
4: Current cluster-head is 74, code is 2, dist is 35
5: Current cluster-head is 97, code is 3, dist is 27
 
Old 02-23-2015, 01:24 AM   #13
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,518

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
← ref. #12.

Looks OK. No errors.

You are getting one warning.
Warnings are not errors. Warnings are informational text.

Also : Please confirm that you have read the examples linked in post #11.


And : Error output text must be in CODE tags ...
. http://www.linuxquestions.org/questi....php?do=bbcode
. http://www.linuxquestions.org/questi...gs-4175464257/
* Please edit your posts.


*The most of the text in post #8 is a quotation : Edit to QUOTE tags.


-
 
Old 02-23-2015, 05:35 AM   #14
Rizwanamalek
Member
 
Registered: Jan 2015
Posts: 56

Original Poster
Rep: Reputation: Disabled
What is the use of this file in leach protocol?. It is necessary ? How to implement it?

MIT_uAMPS_changes_ns
 
Old 02-23-2015, 06:06 AM   #15
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,518

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
← ref. #14.

MIT_uAMPS_changes_ns : Unknown file. Where did you get it ? ?
No file *changes* in any mit/ that I can find.

Besides that, a file CHANGES is usually a "history list".


-
 
  


Reply

Tags
leach, ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Leach implementation on ns-2.35 vijayukani Linux - Wireless Networking 5 01-21-2018 09:35 AM
[SOLVED] LEACH and LEACH-C implementation in ns-2.35 on ubuntu 14.04 wellytg Linux - Newbie 3 12-02-2014 04:42 AM
for Leach implementation on ns2.35 sitender Ubuntu 1 03-19-2013 10:39 AM
implementation of leach protocol in ns2.34 sonatasin Linux - Software 7 03-06-2013 11:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration