How to install leach on ubuntu 10. +

I suppose that ns-2.34 is installed with the compiler gcc-4.3.

The home directory of ns-2.34 is “/buddharaj/ns-allinone-2.34”
1- download the package “ns-234-leach.tar.gz” into the directory “/buddharaj/ns-allinone-2.34/ns-2.34”. and Unzip the ns-234-leach.tar.gz
https://docs.google.com/uc?id=0BzLWx…CNWG1NQK&hl=en
2- download the bash file “leach-setup.sh” into the directory “/buddharaj/ns-allinone-2.34/ns-2.34”.
https://docs.google.com/uc?id=0BzLWx…CJSU5ZYG&hl=en
3- Go to the terminal and go into that directory as:
wsn@ubuntu:~$ cd /opt/ns-allinone-2.34/ns-2.34/ and Open the file “leach-setup.sh” and replace the all occurences
of “/opt/ns-allinone-2.34” with “/home/buddharaj/ns-allinone-2.34” and run  the leach-setup.sh file as:

wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$./leach-setup.sh
4- Open 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”.

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” as
CC    = gcc-4.3
CPP    = g++

& “Makefile.in” as following:
CC    = gcc-4.3
CPP    = @CXX@

7- Insert following code into “yourpath/ns-allinone-2.34/ns-2.34/trace/cmu-trace.h” after the line 59.

#ifdef MIT_uAMPS
#define ADV_CHAR ‘A’
#define REQ_CHAR ‘R’
#define DATA_CHAR ‘D’
#endif

and go to the line number 167 and insert following function there

void     format_rca(Packet *p, int offset);

8- Again delete the code in file “yourpath/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/uamps.tcl” from line number 8 to 20
and insert the following code there

source mit/rca/ns-ranode.tcl
source mit/uAMPS/ns-bsapp.tcl
source mit/uAMPS/extras.tcl
source mit/uAMPS/stats.tcl
source mit/rca/resources/ns-resource-manager.tcl
source mit/rca/resources/ns-energy-resource.tcl
source mit/rca/resources/ns-neighbor-resource.tcl

9- 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

10- If the previous commands passed successfully then you are ready to test your “Leach” by running ./test:
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$./test

11- check the file “leach.err”, if no error reported then go to “leach.out” and enjoy your results!

Advertisements

No comments yet

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

%d bloggers like this: