LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Closed Thread
 
Search this Thread
Old 02-18-2011, 12:51 AM   #166
lilicharmaine
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Rep: Reputation: 8

Hi knudfl,

Suppose if I followed the steps in #3, my old folders will be rename to back-<name> as well right? But then why my old folder's name still exist?

and when I delete the old folders from ns-allinone-2.27, it cannot continue install by prompting me this error:

Code:
============================================================
* Build tcl8.4.5
============================================================
cd: 358: can't cd to ./tcl8.4.5/unix
./install: 365: ./configure: not found
tcl8.3.2 configuration failed! Exiting ...
Tcl is not part of the ns project.  Please see www.Scriptics.com
to see if they have a fix for your platform.
So is it proved that I not yet move/replace everything from old folders?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-18-2011, 07:48 AM   #167
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,278

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
#166, Hi lilicharmaine.

The text
============================================================
* Build tcl8.4.5
============================================================ , etc. etc.

... is from the file 'install', which handles tcl tk otcl tclcl
with the original ( old ) names. That's why e.g. tcl8.4.18 must have a link
by name 'tcl8.4.5', to make it possible for the 'install' script to work.

My ns-allinone-2.27/ looks like this ( 'ls ns-allinone-2.27/' )
Code:
[knudfl@localhost ns-allinone-2.27]$ ls
back-otcl-1.8/    gt-itm/        ns-2.27/    tcl8.4.18@   xgraph-12.1/
back-tcl8.4.5/    include/       otcl-1.13@  tcl8.4.5@    zlib-1.1.4/
back-tclcl-1.15/  install*       otcl-1.8@   tclcl-1.15@
back-tk8.4.5/     INSTALL.WIN32  README      tclcl-1.19@
bin/              lib/           sgb/        tk8.4.18@
cweb/             nam-1.10/      share/      tk8.4.5@
 
Old 02-18-2011, 10:33 AM   #168
lilicharmaine
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Rep: Reputation: 8
Hi knudfl,

Your folders is exactly same as mine, but I don't know what wrong, maybe I try to
install all over again, hopefully don't have the error again, thanks
 
Old 02-18-2011, 10:57 AM   #169
lilicharmaine
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Rep: Reputation: 8
Hi knudfl,

May I get the exact ns2.27 and ns2.34 version from you? maybe the one I download have errors, thanks

and, another question is how can I download the tk-8.4 patch and otcl-113 patch into my directory without using the cp command? thanks
 
Old 02-18-2011, 12:03 PM   #170
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,278

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
# 169 , @lilicharmaine : Hi again.

These are the only versions, AFAIK :
ns-allinone-2.27.tar.gz and ns-allinone-2.34.tar.gz
http://www.isi.edu/nsnam/dist/ : ns-allinone-2.27.tar.gz
http://sourceforge.net/projects/nsna...allinone-2.34/

cp <patch> is OK. But not required.
'patch -p<option> < <path-to-the-patch>/<patch>' works as well.

Downloading e.g. the tk-8.4-lastevent.patch :
1) cd tk-8.4.18/
2) wget ftp://ftp.uni-kl.de/pub/linux/gentoo...astevent.patch
I.e. using a link that ends with the file name is most convenient :
http://www.filewatcher.com/m/tk-8.4-....1095.0.0.html

May be you should omit the 'otcl-113 patch'.
Actually "CC = gcc-4.3" is the proof method. No guaranty that the patch will work.
On one Ubuntu version ( 9.10 ? ) we have seen errors / no errors,
both with and without the patch !

..

Last edited by knudfl; 02-18-2011 at 12:16 PM.
 
Old 02-18-2011, 12:36 PM   #171
lilicharmaine
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Rep: Reputation: 8
Hi knudfl,

I had follow what you had told, by omitting the otcl patch, it still give me the same error.

May I know which ubuntu version is used for the instruction in post #3 ?
 
Old 02-18-2011, 01:10 PM   #172
lilicharmaine
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Rep: Reputation: 8
Hi knudfl,

I had found the solution that you gave in some other thread (ns installation wont let me do it in ubuntu 9.10, post #4).

The following errors :
Code:
otcl.o: In function `OTclDispatch':
/home/lilicharmaine/ns/ns-allinone-2.27/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/lilicharmaine/ns/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
otcl-1.13 make failed! Exiting ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
The solution: is by editing
Code:
ns-allinone-2.27/otcl-1.13/Makefile.in
CC    gcc-3.3            (line 7)
Thanks a lot, you really help me solved my problems, thanks again
 
Old 02-19-2011, 01:17 PM   #173
lilicharmaine
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Rep: Reputation: 8
Hi all,

I am having error in leach.err as following:

Code:
invalid command name "Resource/Energy"
    while executing
"Resource/Energy instproc setParams {args} {
    $self instvar energyLevel_ alarmLevel_
    set energyLevel_ [lindex $args 0]
    set alarmLevel_ [lind..."
    (file "/home/shiayok/ns-allinone-2.27/ns-2.27/mit/rca//resources/ns-energy-resource.tcl" line 11)
    invoked from within
"source.orig /home/shiayok/ns-allinone-2.27/ns-2.27/mit/rca//resources/ns-energy-resource.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 $env(RCA_LIBRARY)/resources/ns-energy-resource.tcl"
    (file "mit/uAMPS/sims/uamps.tcl" line 18)
    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)
May I know how can I solve this problem? thanks

-- and my leach.out is empty because of the above error, i need to solve it in order to get answer, thanks
 
Old 02-19-2011, 02:46 PM   #174
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,278

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
Post # 173 : Which command is used ? ?

And what is your location, where you execute the command ?

( Please use the command pwd to know your location.)
 
Old 02-19-2011, 03:48 PM   #175
lilicharmaine
LQ Newbie
 
Registered: Feb 2011
Posts: 13

Rep: Reputation: 8
Hi all,

By getting the help from all of you (especially knudfl), I have complete LEACH protocol installation in ns-allinone-2.27 (ubuntu10.10), and I compiled the complete instructions as following, hope it can help you, Good luck !!

Code:
Installing ns2.27 in UBUNTU 10.10
After finished installed the UBUNTU 10.10

Installation for ns-allinone-2.27 in ubuntu10.10

Step 1: download ns-allinone-2.27.tar.gz and ns-allinone-2.34.tar.gz
cd /home/<path>
wget http://www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz
gunzip ns-allinone-2.27.tar.gz
tar –xvf ns-allinone-2.27.tar
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/nsnam/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz
gunzip ns-allinone-2.34.tar.gz
tar –xvf ns-allinone-2.34.tar

Step 2:
Edit ns-allinone-2.27/ns-2.27/Makefile.in, line 36-37 to:
CC = gcc-3.3
CPP = g++-3.3
and ns-allinone-2.27/nam-1.10/Makefile.in, line44-45 to:
CC = gcc-3.3
CPP = g++-3.3

Step 3: The g++-3.3 packages required, so download the following compiler version
wget http://cvsup9.tw.freebsd.org/pub/Linux/Ubuntu/pool/universe/g/gcc-3.3/cpp-3.3_3.3.6-15ubuntu4_i386.deb
wget http://ftp.jaist.ac.jp/pub/Linux/ubuntu//pool/universe/g/gcc-3.3/g++-3.3_3.3.6-15ubuntu4_i386.deb
wget http://mirror.netcologne.de/ubuntu//pool/universe/g/gcc-3.3/gcc-3.3_3.3.6-15ubuntu4_i386.deb
wget http://free.nchc.org.tw/ubuntu//pool/universe/g/gcc-3.3/gcc-3.3-base_3.3.6-15ubuntu4_i386.deb
wget http://mirror.pnl.gov/ubuntu//pool/universe/g/gcc-3.3/libstdc++5-3.3-dev_3.3.6-15ubuntu4_i386.deb

Step 4: install the g++-3.3 packages
sudo dpkg -i cpp-3.3_3.3.6-15ubuntu4_i386.deb g++-3.3_3.3.6-15ubuntu4_i386.deb \ 
gcc-3.3_3.3.6-15ubuntu4_i386.deb gcc-3.3-base_3.3.6-15ubuntu4_i386.deb \
libstdc++5-3.3-dev_3.3.6-15ubuntu4_i386.deb

Step 5:
Having ns-allinone-2.27/ and ns-allinone-2.34/ in the same directory, 
e.g: /home/<path>/ns2:
cd ns-allinone-2.27/
mv otcl-1.8/ back-otcl-1.8
mv tcl8.4.5/ back-tcl8.4.5
mv tclcl-1.15/ back-tclcl-1.15
mv tk8.4.5/ back-tk8.4.5

ln -s ../ns-allinone-2.34/tcl8.4.18/
ln -s ../ns-allinone-2.34/tcl8.4.18/ tcl8.4.5
ln -s ../ns-allinone-2.34/tk8.4.18/
ln -s ../ns-allinone-2.34/tk8.4.18/ tk8.4.5
ln -s ../ns-allinone-2.34/otcl-1.13/
ln -s ../ns-allinone-2.34/otcl-1.13/ otcl-1.8
ln -s ../ns-allinone-2.34/tclcl-1.19/
ln -s ../ns-allinone-2.34/tclcl-1.19/ tclcl-1.15

mkdir -p include
cd include/
ln -s ../tcl8.4.18/generic/tclInt.h
ln -s ../tcl8.4.18/generic/tclIntDecls.h
( These two links may already be present.)

Step 6: Apply tk-8.4-lastevent.patch in ns-allinone-2.27/tk8.4.18
wget  ftp://ftp.uni-kl.de/pub/linux/gentoo-portage/dev-lang/tk/files/tk-8.4-lastevent.patch
patch –p0 < tk-8.4-lastevent.patch

NOTE: ignore the error as following:
Hunk #1 FAILED at 635
1 out of 1 hunk FAILED -- saving rejects to file generic/tk.h.rej

Step 7:
Edit ns-allinone-2.27/otcl-1.13/Makefile.in, line7 to:
CC   gcc-3.3

Step 8:
cd ns-allinone-2.27
./install

Step 9: type the following messages in the same directory (/ns-allinone-2.27/)
PATH=$PATH:$HOME/bin:/home/<path>/ns-allinone-2.27/bin:/home/<path>/ns-allinone-2.27/tcl8.4.18/unix:/home/<path>/ns-allinone-2.27/tk8.4.18/unix

export LD_LIBRARY_PATH=/home/<path>/ns-allinone-2.27/otcl-1.13:/home/<path>/ns-allinone-2.27/lib

export TCL_LIBRARY=/home/<path>/ns-allinone-2.27/tcl8.4.18/library

./validate

COMPLETE !!!


Install LEACH protocol in ns2.27

Step 1: download mit.tar.gz (mit.tar.gz can be download at same thread, post #155)
cd ns-allinone-2.27/ns-2.27

Step 2: allocate mit.tar.gz into this directory
gunzip mit.tar.gz
tar –xvf mit.tar
gedit ~/ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc

goto line 59, that is after line 58
 #define max(a,b) (((a)<(b))?(b):(a))
insert:
 #define min(a,b) (((a)>(b))?(b):(a))

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

Step 4:
At the same directory, do:
make clean
make

Then, type
./test

You will get an error called
./test: line 5: ./leach_test: No such file or directly

So we correct it by:
cd ns-allinone-2.27/ns-2.27 
gedit test 

change the following codes:
#!/bin/bash
cd tcl/ex
ns wireless-demo-csci694.tcl
sleep 2
./leach_test
cd ../../

to this :
#!/bin/bash
cd tcl/ex
ns wireless-demo-csci694.tcl
sleep 2

cd ../../
./leach_test

Step 5:
gedit ~/.bashrc

at last line, insert:
export RCA_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/rca
export uAMPS_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/uAMPS

NOTE: Must using “~” although your directory is not in “~” root

cd ns-allinone-2.27/ns-2.27, 

type the following again:
export RCA_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/rca
export uAMPS_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/uAMPS

NOTE: Must using “~” although your directory is not in “~” root

Step 6 (directory: ns-allinone-2.27/ns-2.27):
./test

Check :
ns-allinone-2.27/ns-2.27/mit/rca/leach.err,

if having the following error:
invalid command name “Resource/Energy”
	while executing
“Resource/Energy” instproc set param
….

then re-install ns-2.27 by:
 cd ns-allinone-2.27/
./install

Then repeat the following steps again:
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

make clean
make

If now you have CPP_NAMESPACE error, then go to three of the directory to insert:
Append this:
-DCPP_NAMESPACE=std 

into 3 of the directory and appended as shown respectively:
ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile  (append in DEFINE)
ns-2.27indep-utils/webtrace-conv/dec/Makefile (append in CFLAGS)
ns-2.27/indep-utils/webtrace-conv/ulanr/Makefile (append in CFLAGS)

Repeat:
cd ns-allinone-2.27/ns-2.27
make clean
make
sudo make install

type the following again:
export RCA_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/rca
export uAMPS_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/uAMPS

NOTE: Must using “~” although your directory is not in “~” root

./test

cd ns-allinone-2.27/ns-2.27/mit/leach-sims/leach.err

You should now see (leach.err):
INITIALIZE THE LIST xListHead
Channel.cc:sendUp – Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 222.8
SORTING LISTS …DONE!

And
cd ns-allinone-2.27/ns-2.27/mit/leach-sims/leach.out
will be the result (due to permission, the result must be see by using other method)

Only then it shows your LEACH installation is successful. GOOD LUCK !!

COMPLETE!!!
 
2 members found this post helpful.
Old 02-24-2011, 08:03 AM   #176
keepwalking
Member
 
Registered: Oct 2010
Posts: 46

Rep: Reputation: 0
Hey guys Im trying to add LEACH on ns2.34 but dont know how to do it can any one help me with instruction of how to add it.
 
Old 02-24-2011, 02:22 PM   #177
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,278

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
#176 :

EDIT : New package ns-234-leach.tar.gz etc. here, post # 5
http://www.linuxquestions.org/questi...34-a-870368/#5

(( Old : Please start with reading posts # 68 # 78 # 88
The patch, old version = tarik-ns234-leach.tar.bz2
https://docs.google.com/leaf?id=0B7S...thkey=CJzYt5QP ))

..
Attached Files
File Type: txt README-leach-ns234.html.txt (3.0 KB, 16 views)

Last edited by knudfl; 04-05-2011 at 01:31 PM.
 
Old 02-26-2011, 02:09 PM   #178
pawanmehra
LQ Newbie
 
Registered: Feb 2011
Posts: 8

Rep: Reputation: 0
Quote:
Originally Posted by lilicharmaine View Post
Hi all,

By getting the help from all of you (especially knudfl), I have complete LEACH protocol installation in ns-allinone-2.27 (ubuntu10.10), and I compiled the complete instructions as following, hope it can help you, Good luck !!

Code:
Installing ns2.27 in UBUNTU 10.10
After finished installed the UBUNTU 10.10

Installation for ns-allinone-2.27 in ubuntu10.10

Step 1: download ns-allinone-2.27.tar.gz and ns-allinone-2.34.tar.gz
cd /home/<path>
wget http://www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz
gunzip ns-allinone-2.27.tar.gz
tar –xvf ns-allinone-2.27.tar
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/nsnam/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz
gunzip ns-allinone-2.34.tar.gz
tar –xvf ns-allinone-2.34.tar

Step 2:
Edit ns-allinone-2.27/ns-2.27/Makefile.in, line 36-37 to:
CC = gcc-3.3
CPP = g++-3.3
and ns-allinone-2.27/nam-1.10/Makefile.in, line44-45 to:
CC = gcc-3.3
CPP = g++-3.3

Step 3: The g++-3.3 packages required, so download the following compiler version
wget http://cvsup9.tw.freebsd.org/pub/Linux/Ubuntu/pool/universe/g/gcc-3.3/cpp-3.3_3.3.6-15ubuntu4_i386.deb
wget http://ftp.jaist.ac.jp/pub/Linux/ubuntu//pool/universe/g/gcc-3.3/g++-3.3_3.3.6-15ubuntu4_i386.deb
wget http://mirror.netcologne.de/ubuntu//pool/universe/g/gcc-3.3/gcc-3.3_3.3.6-15ubuntu4_i386.deb
wget http://free.nchc.org.tw/ubuntu//pool/universe/g/gcc-3.3/gcc-3.3-base_3.3.6-15ubuntu4_i386.deb
wget http://mirror.pnl.gov/ubuntu//pool/universe/g/gcc-3.3/libstdc++5-3.3-dev_3.3.6-15ubuntu4_i386.deb

Step 4: install the g++-3.3 packages
sudo dpkg -i cpp-3.3_3.3.6-15ubuntu4_i386.deb g++-3.3_3.3.6-15ubuntu4_i386.deb \ 
gcc-3.3_3.3.6-15ubuntu4_i386.deb gcc-3.3-base_3.3.6-15ubuntu4_i386.deb \
libstdc++5-3.3-dev_3.3.6-15ubuntu4_i386.deb

Step 5:
Having ns-allinone-2.27/ and ns-allinone-2.34/ in the same directory, 
e.g: /home/<path>/ns2:
cd ns-allinone-2.27/
mv otcl-1.8/ back-otcl-1.8
mv tcl8.4.5/ back-tcl8.4.5
mv tclcl-1.15/ back-tclcl-1.15
mv tk8.4.5/ back-tk8.4.5

ln -s ../ns-allinone-2.34/tcl8.4.18/
ln -s ../ns-allinone-2.34/tcl8.4.18/ tcl8.4.5
ln -s ../ns-allinone-2.34/tk8.4.18/
ln -s ../ns-allinone-2.34/tk8.4.18/ tk8.4.5
ln -s ../ns-allinone-2.34/otcl-1.13/
ln -s ../ns-allinone-2.34/otcl-1.13/ otcl-1.8
ln -s ../ns-allinone-2.34/tclcl-1.19/
ln -s ../ns-allinone-2.34/tclcl-1.19/ tclcl-1.15

mkdir -p include
cd include/
ln -s ../tcl8.4.18/generic/tclInt.h
ln -s ../tcl8.4.18/generic/tclIntDecls.h
( These two links may already be present.)

Step 6: Apply tk-8.4-lastevent.patch in ns-allinone-2.27/tk8.4.18
wget  ftp://ftp.uni-kl.de/pub/linux/gentoo-portage/dev-lang/tk/files/tk-8.4-lastevent.patch
patch –p0 < tk-8.4-lastevent.patch

NOTE: ignore the error as following:
Hunk #1 FAILED at 635
1 out of 1 hunk FAILED -- saving rejects to file generic/tk.h.rej

Step 7:
Edit ns-allinone-2.27/otcl-1.13/Makefile.in, line7 to:
CC   gcc-3.3

Step 8:
cd ns-allinone-2.27
./install

Step 9: type the following messages in the same directory (/ns-allinone-2.27/)
PATH=$PATH:$HOME/bin:/home/<path>/ns-allinone-2.27/bin:/home/<path>/ns-allinone-2.27/tcl8.4.18/unix:/home/<path>/ns-allinone-2.27/tk8.4.18/unix

export LD_LIBRARY_PATH=/home/<path>/ns-allinone-2.27/otcl-1.13:/home/<path>/ns-allinone-2.27/lib

export TCL_LIBRARY=/home/<path>/ns-allinone-2.27/tcl8.4.18/library

./validate

COMPLETE !!!


Install LEACH protocol in ns2.27

Step 1: download mit.tar.gz (mit.tar.gz can be download at same thread, post #155)
cd ns-allinone-2.27/ns-2.27

Step 2: allocate mit.tar.gz into this directory
gunzip mit.tar.gz
tar –xvf mit.tar
gedit ~/ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc

goto line 59, that is after line 58
 #define max(a,b) (((a)<(b))?(b):(a))
insert:
 #define min(a,b) (((a)>(b))?(b):(a))

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

Step 4:
At the same directory, do:
make clean
make

Then, type
./test

You will get an error called
./test: line 5: ./leach_test: No such file or directly

So we correct it by:
cd ns-allinone-2.27/ns-2.27 
gedit test 

change the following codes:
#!/bin/bash
cd tcl/ex
ns wireless-demo-csci694.tcl
sleep 2
./leach_test
cd ../../

to this :
#!/bin/bash
cd tcl/ex
ns wireless-demo-csci694.tcl
sleep 2

cd ../../
./leach_test

Step 5:
gedit ~/.bashrc

at last line, insert:
export RCA_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/rca
export uAMPS_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/uAMPS

NOTE: Must using “~” although your directory is not in “~” root

cd ns-allinone-2.27/ns-2.27, 

type the following again:
export RCA_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/rca
export uAMPS_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/uAMPS

NOTE: Must using “~” although your directory is not in “~” root

Step 6 (directory: ns-allinone-2.27/ns-2.27):
./test

Check :
ns-allinone-2.27/ns-2.27/mit/rca/leach.err,

if having the following error:
invalid command name “Resource/Energy”
	while executing
“Resource/Energy” instproc set param
….

then re-install ns-2.27 by:
 cd ns-allinone-2.27/
./install

Then repeat the following steps again:
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

make clean
make

If now you have CPP_NAMESPACE error, then go to three of the directory to insert:
Append this:
-DCPP_NAMESPACE=std 

into 3 of the directory and appended as shown respectively:
ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile  (append in DEFINE)
ns-2.27indep-utils/webtrace-conv/dec/Makefile (append in CFLAGS)
ns-2.27/indep-utils/webtrace-conv/ulanr/Makefile (append in CFLAGS)

Repeat:
cd ns-allinone-2.27/ns-2.27
make clean
make
sudo make install

type the following again:
export RCA_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/rca
export uAMPS_LIBRARY=~/ns-allinone-2.27/ns-2.27/mit/uAMPS

NOTE: Must using “~” although your directory is not in “~” root

./test

cd ns-allinone-2.27/ns-2.27/mit/leach-sims/leach.err

You should now see (leach.err):
INITIALIZE THE LIST xListHead
Channel.cc:sendUp – Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 222.8
SORTING LISTS …DONE!

And
cd ns-allinone-2.27/ns-2.27/mit/leach-sims/leach.out
will be the result (due to permission, the result must be see by using other method)

Only then it shows your LEACH installation is successful. GOOD LUCK !!

COMPLETE!!!
thanks alot
god bless you
 
Old 02-26-2011, 03:24 PM   #179
pawanmehra
LQ Newbie
 
Registered: Feb 2011
Posts: 8

Rep: Reputation: 0
Leach Code Help

Dear all

Can any one help me how to run the Leach code and see the output...

Thanks in advance
 
Old 02-26-2011, 03:29 PM   #180
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Quote:
Originally Posted by pawanmehra View Post
Dear all

Can any one help me how to run the Leach code and see the output...

Thanks in advance
Doesn't this thread help at all?
 
  


Closed Thread

Tags
leach, leach-ns227, ns2, ns227


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in simulating Black Hole Attack in AODV Protocol through NS2 in FC8 shyan Linux - Newbie 1 03-21-2009 06:28 AM
NS2 installation ds_priyaa Fedora 2 05-28-2008 03:23 AM
NS2 installation eby83 Linux - Newbie 2 06-11-2007 02:08 AM
ns2 installation pranoti Linux - Software 2 06-11-2007 01:45 AM
LXer: Interview with Bernard Leach (iPodLinux) LXer Syndicated Linux News 0 10-31-2006 12:33 PM


All times are GMT -5. The time now is 01:36 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration