LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Leach protocol (https://www.linuxquestions.org/questions/linux-newbie-8/leach-protocol-933441/)

anitha.r.u 03-08-2012 10:39 AM

Leach protocol
 
Hi,

I am working on LEACH protocol. I have just installed NS2.27 onto my system in fedora. Following the LEACH installation steps I just need the mit.tar.gz file for LEACH and also I require leach_makefile-2.27.patch for further installation.

I already tried the following links,but it fails.

http://www.internetworkflow.com/down...ach/mit.tar.gz .

Leach make file:

http://www.internetworkflow.com/down...leach/Makefile

Can anyone suggest me where can I download this patch for LEACH.

Thank you

knudfl 03-09-2012 02:54 AM

Welcome to LQ. .. :) ..

Links to files, etc. here, post # 4
http://www.linuxquestions.org/questi...each-862835/#4


The 500 LEACH posts at LQ :
LQ Search , TAG = leach

.

trung65 03-09-2012 10:27 AM

HI all,sorry for my poor English im a newbie in linux and im trying to implement LEACH on ns2.27. I must send a special thank to Knudfl, base on ur instructions, i do install successfully ns2.27 in ubuntu 10.04. Now on the LEACH phase,im stuck. I read the whole thead 18 page (which is closed) and have some questions. Please guide me.
1. I cant Make -f the knudfl's file (please see the below)

trung@ubuntu:~/ns-allinone-2.27/ns-2.27$ make -f 1-LEACH-Makefile-modified.txt.doc
1-LEACH-Makefile-modified.txt.doc:1: warning: NUL character seen; rest of line ignored
1-LEACH-Makefile-modified.txt.doc:1: *** missing separator. Stop.

2. So im trying the LEACH-makefile-org, ( already edit the gcc,g++ >>3.3;add DMIT_uAMPS; -I./mit/rca -I./mit/uAMPS and 3 lines after GAF...)
then, result in error http://www.linuxquestions.org/questi...379/page2.html post#25

3. I try ur instruction in #26 ,which i dont understand clearly.
i do :
cd otcl-1.13/ && ./configure --prefix=/usr --enable-release --enable-devel
and Make >>> error below

trung@ubuntu:~/ns-allinone-2.27/otcl-1.13$ make
rm -f libotcl.so otcl.o so_locations
gcc -c -g -O2 -fsigned-char -fno-inline -DUSE_SHM -fpic -I. -I/home/trung/ns-allinone-2.27/tk8.4.18/generic -I/home/trung/ns-allinone-2.27/tcl8.4.18/generic -I/home/trung/ns-allinone-2.27/tcl8.4.18/generic -I/include otcl.c
ld -shared -o libotcl.so otcl.o
otcl.o: In function `OTclDispatch':
/home/trung/ns-allinone-2.27/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/trung/ns-allinone-2.27/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: Nonrepresentable section on output
make: *** [libotcl.so] Error 1

Bypass it, i try the next step with tclcl-1.19, result in below:

trung@ubuntu:~/ns-allinone-2.27/tclcl-1.19$ make
make: Nothing to be done for `all'.
trung@ubuntu:~/ns-allinone-2.27/tclcl-1.19$ sudo make install
/usr/bin/install -c -m 644 *.h /usr/include
/usr/bin/install -c tcl2c++ /usr/bin
/usr/bin/install -c libtclcl.a /usr/lib
ranlib /usr/lib/libtclcl.a

...and the next 2 sudo apt command :

trung@ubuntu:~/ns-allinone-2.27/otcl-1.13$ sudo apt-get remove tcl8.5-dev tk8.5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package tcl8.5-dev is not installed, so not removed
Package tk8.5-dev is not installed, so not removed
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
libstdc++5-3.3-dev: Depends: libstdc++5 (>= 1:3.3.6-15ubuntu4) but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
trung@ubuntu:~/ns-allinone-2.27/otcl-1.13$ sudo apt-get install tcl8.4-dev tk8.4-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
tcl8.4-dev is already the newest version.
tk8.4-dev is already the newest version.
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
libstdc++5-3.3-dev: Depends: libstdc++5 (>= 1:3.3.6-15ubuntu4) but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Please help me this problem.. thank u!
Best regards!

trung65 03-09-2012 10:49 AM

Sorry if it is a double post :| . I also have a question about post #175 in the same above thread http://www.linuxquestions.org/questi...79/page12.html. I dont understand about step modify the Makefile in ns2.27

Step 3:
cd ns-allinone-2.27/ns-2.27/
gedit Makefile

Do the following in Makefile:
Add -DMIT_uAMPS to the DEFINE list
Add -I./mit/rca -I./mit/uAMPS to the INCLUDE list
Add the following just prior to the (before) line gaf/gaf.o \
mit/rca/energy.o mit/rca/rcagent.o \
mit/rca/rca-ll.o mit/rca/resource.o \
mac/mac-sensor-timers.o mac/mac-sensor.o mit/uAMPS/bsagent.o \
save the Makefile.

Does it mean we dont need the "LEACH-makefile-modified" ? I tried these steps and have the same error in http://www.linuxquestions.org/questi...379/page4.html post #50, after do Makeclean && make, i received:

make[1]: Entering directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest'
make[1]: Entering directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec'
make[1]: Entering directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/epa'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/epa'
make[1]: Entering directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/nlanr'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/nlanr'
make[1]: Entering directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/ucb'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/trung/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/ucb'

I followed the ur next post #51, but again, i dont understand it clearly and still cant make -f the LEACH-makefile as the same as my post above.
Can u explain it to me? Thank you!

knudfl 03-11-2012 11:02 AM

1 Attachment(s)
# 3, # 4
Quote:

gcc -c -g -O2 -fsigned-char -fno-inline -DUSE_SHM -fpic -I. -I.........
"gcc" should be gcc-3.3, when Ubuntu 10.04 is used :
sudo apt-get install g++-3.3

The latest install guide for ns-allinone-2.27 / Ubuntu (10.04)
http://www.linuxquestions.org/questi...10-a-782356/#3

About the Makefile :
1) The "1-LEACH-Makefile-modified.txt" will usually work OK
in Ubuntu. But not if you use it / save it "as a .doc format".
2) May be easier with a new Makefile.in ? With the new objects added.
Then it's : export CC=gcc-3.3 CXX=g++-3.3 && ./configure && make
... The attached Makefile.in.leach.txt should be renamed to Makefile.in


Quote:

indep-utils/cmu-scen-gen/setdest'
make[1]: Nothing to be done for `all'.
"indep-utils/" : Not used with LEACH. Nothing to be done for `all' :
Means OK, these files were compiled with the previous 'make'.


P.S. : Simpler to use ns-2.34 for LEACH ?
http://www.linuxquestions.org/questi...34-a-870368/#5
And http://www.linuxquestions.org/questi...ra13-907076/#9
http://www.linuxquestions.org/questi...a13-907076/#11

.

trung65 03-11-2012 01:13 PM

Thanks for helping me, first, i download The "1-LEACH-Makefile-modified.txt" to win7 and it has a word file format, i copy to virtual machine ubuntu and it cant be used although i deleted the suffix .txt
I tried ur second instruction as :
-delete the old makefile.in
-download ur attach file and rename
-edit it with some add (uAMPS, 3 lines after gaf...),
-./configure && make >>> error as the below: (i post the last part)

mit/uAMPS/bsagent.o:bsagent.cc:(.text+0x15f6): first defined here
mit/uAMPS/bsagent.o: In function `BSAgent::itoa(int, char*)':
bsagent.cc:(.text+0x150e): multiple definition of `BSAgent::itoa(int, char*)'
mit/uAMPS/bsagent.o:bsagent.cc:(.text+0x150e): first defined here
mit/rca/rcagent.o: In function `RCAgent::sendmsg(int, char const*, int, int, double, int)':
rcagent.cc:(.text+0x766): undefined reference to `hdr_rca::offset_'
mit/rca/rcagent.o: In function `RCAgent::recv(Packet*, Handler*)':
rcagent.cc:(.text+0x8a6): undefined reference to `hdr_rca::offset_'
mit/rca/rca-ll.o: In function `RCALinkLayer::sendDown(Packet*)':
rca-ll.cc:(.text+0x10): undefined reference to `hdr_rca::offset_'
mit/rca/rca-ll.o: In function `RCALinkLayer::sendUp(Packet*)':
rca-ll.cc:(.text+0x1bd): undefined reference to `hdr_rca::offset_'
mac/mac-sensor.o: In function `MacSensor::send(Packet*, Handler*)':
mac-sensor.cc:(.text+0x4da): undefined reference to `hdr_rca::offset_'
mac/mac-sensor.o:mac-sensor.cc:(.text+0x6ad): more undefined references to `hdr_rca::offset_' follow
collect2: ld returned 1 exit status
make: *** [ns] Error 1

I did something wrong?
Please guide me... And im a bit confuse with makefile & makefile.in . So when we edit the first? when for the second one? And you linked me a threat about 2.34 leach. I wonder if it's easier for me to implement leach? I have no experience in Fedora,CentOS.. only have a little bit about ubuntu :(. So do the thread about ns2.34 in Fedora13 can help me the same with ubuntu 10.04?
Thank u Knudfl!
Best Regard!

knudfl 03-11-2012 01:18 PM

# 6

!! It's not : ./configure && make

But : export CC=gcc-3.3 CXX=g++-3.3 && ./configure && make


And : You will probably have to do a 'make clean' before 'make'.

.

trung65 03-11-2012 09:09 PM

Hi knudfl, i tried ur step, also do 'make clean' before.. the error still almost the same :

mit/uAMPS/bsagent.o:bsagent.cc:(.text+0x92c): first defined here
mit/uAMPS/bsagent.o: In function `BSAgent::recv(Packet*, Handler*)':
bsagent.cc:(.text+0xa9e): multiple definition of `BSAgent::recv(Packet*, Handler*)'
mit/uAMPS/bsagent.o:bsagent.cc:(.text+0xa9e): first defined here
mit/uAMPS/bsagent.o: In function `BSAgent::find_min_dist(double*, double*, int, double*, double*, int, int*, int*)':
bsagent.cc:(.text+0x15f6): multiple definition of `BSAgent::find_min_dist(double*, double*, int, double*, double*, int, int*, int*)'
mit/uAMPS/bsagent.o:bsagent.cc:(.text+0x15f6): first defined here
mit/uAMPS/bsagent.o: In function `BSAgent::itoa(int, char*)':
bsagent.cc:(.text+0x150e): multiple definition of `BSAgent::itoa(int, char*)'
mit/uAMPS/bsagent.o:bsagent.cc:(.text+0x150e): first defined here
collect2: ld returned 1 exit status
make: *** [ns] Error 1

I'll try the Leach in ns2.34 while waiting for ur answer. Thank u!

knudfl 03-12-2012 03:19 AM

# 8

Please show the output from the command : g++-3.3 --version

trung65 03-12-2012 11:58 AM

Quote:

Originally Posted by knudfl (Post 4624533)
# 8

Please show the output from the command : g++-3.3 --version

hi knudfl, here is the output :

trung@ubuntu:~/ns-allinone-2.27/ns-2.27$ g++-3.3 --version
g++-3.3 (GCC) 3.3.6 (Ubuntu 1:3.3.6-15ubuntu4)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

In my opinion, it's not the error...maybe i'm wrong?

knudfl 03-12-2012 01:14 PM

# 10

Are you quite sure, that g++-3.3 is used ?

ns-allinone-2.27/ns-2.27/Makefile , line 37 : CPP = g++-3.3

Be aware that the export command is temporary. If you exit the
terminal before doing ./configure, you will reset to plain g++.

g++-3.3 used to work on Ubuntu 9.10 with ns-2.27 :
http://www.linuxquestions.org/questi...10-a-782356/#3

.

trung65 03-12-2012 11:47 PM

Hi knudfl
Here is the makefile :

# The following will be redefined under Windows (see WIN32 lable below)
CC = gcc-3.3
CPP = g++-3.3

And the makefile.in:

# The following will be redefined under Windows (see WIN32 lable below)
CC = @CC@
CPP = @CXX@

As i mentioned in #6,im confuse between these two files,wonder when edit the first or the second..
I also tried to edit all two files with CC= gcc-3.3,CPP= g++-3.3 and export,configure,make clean, make...again, but it result the same error. I worked with only 1 command terminal as you noticed. After error, i checked again the gcc-3.3 version, still g++-3.3 (GCC) 3.3.6 (Ubuntu 1:3.3.6-15ubuntu4)
I also have question about this line in Makefile :

TCLSH = /home/trung/ns-allinone-2.27/bin/tclsh8.4

I saw in a thread that it must be changed, isn't it?
Thank you again for quickly reply me!

knudfl 03-13-2012 02:11 AM

# 12

Why care about the Makefile ?

Please generate a new one from the Makefile.in , post # 5
cd ns-allinone-2.27/ns-2.27/ &&
export CC=gcc-3.3 CXX=g++-3.3 && ./configure && make clean && make

trung65 03-13-2012 08:55 AM

Hi knudfl!
I restored my virtual machine and do the same as you guide,with the new Makefile.in and it result in the same error as post #4
What should i do next...

knudfl 03-13-2012 12:51 PM

# 14
Quote:

... the same error as post #4
What do you mean ? ? ? I don't see any errors ( Or the word error.)

Post # 5 explains ..
"" Nothing to be done for `all' "" : means OK.

.


All times are GMT -5. The time now is 10:46 PM.