LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   LEACH protocol installation on NS2.27 (https://www.linuxquestions.org/questions/linux-general-1/leach-protocol-installation-on-ns2-27-a-785379/)

sawyer 01-31-2011 04:23 AM

thanks for the reply but I didnt understand ur answer, please can you post specifically wat to do

Regards,
Sawyer

nirmalak 02-10-2011 02:50 AM

i am working n clustering can u brief out about the posts above i find it difficult to understand.... actually wat should we do to implement leach protocol... how to bind C++ code to a tcl code and how to run it

sawyer 02-11-2011 02:21 AM

Answer
 
Hey,

First of all I like to get your idea clearly. What exactly you want to do. Whether you want to modify existing protocols or propose a new one.

LEACH is a clustering protocol. We have a code for LEACH for NS-2.27. No need for implementation.

C++ serves like the backend for Network simulator NS2. Tcl is used for creating nodes, establishing links between the nodes. That is parameters for simulation are written in Tcl.

C++ and Tcl are binded together and called Otcl. With Otcl we can call some classes from C++ programs to Tcl.

For clear understanding better u wiki, u have ample of material available on net for Tcl, Otcl and C++.

Regards,
Sawyer

lilicharmaine 02-16-2011 10:32 PM

Hi
 
may I get the following source files from you, Thanks for help :)

mit.tar.gz + LEACH-Makefile-org

knudfl 02-17-2011 05:56 AM

@lilicharmaine , post # 154 : Welcome to LQ. .. .. :) ..

The "old leach link" http://www.internetworkflow.com/downloads/ns2leach
seems to be down currently. I have uploaded the files to Google Docs.

All the links are in this LQ post :
http://www.linuxquestions.org/questi...each-862835/#4

Good luck !

..

lilicharmaine 02-17-2011 08:34 AM

Hi knufl,

Thanks for your help :) I got all the files..

lilicharmaine 02-17-2011 10:40 AM

Hi,

May I know where can I get the ns2.27-gcc410 patch file? I need it for ns2.27-allinone-tar.gz installation in Ubuntu 10.10, thanks :)

knudfl 02-17-2011 11:13 AM

Post # 157 : The ns-2.27-gcc410.patch is here (Google .. ns-2.27-gcc410.patch ..)
http://cfs3.tistory.com/upload_contr...7-gcc410.patch

But you may not have much luck with the patch.

The rather complicated build method, you were pointed to is used for a reason:
http://www.linuxquestions.org/questi...10-a-782356/#3

But who knows ? You could be that lucky with Ubuntu 10.10 ?

..

lilicharmaine 02-17-2011 12:44 PM

Hi knudlf,

Thanks a lot for your help, really appreciates it :)

I got the ns2.27-gcc410 patch file, but I cannot managed to install successful in ubuntu10.10.

But I did follow the instruction from post #3, when I reach the step of tk8.4-lastevent file patching,
it prompted me the following error, may I know what is the solutions for that?

====================================================================
run --> patch -p0 < tk-8.4-lastevent.patch
patching file generic/tk.h

error -->
Hunk #1 FAILED at 635
1 out of 1 hunk FAILED -- saving rejects to file generic/tk.h.rej
====================================================================

knudfl 02-17-2011 01:15 PM

Post # 159 , lilicharmaine.

'cd tk8.4.14/ && patch -p0 < tk-8.4-lastevent.patch'
1 out of 1 hunk FAILED : Can be ignored. Concerns mainly nam.
And nam is a seperate application : Any binary nam can be used.

When you have finished the build of ns-allinone-2.27 and the LEACH files,
you can do : sudo apt-get install nam
Installing nam before you have fished everything, may disturb your install:
The dependencies for nam ( libotcl1 tcl8.4 tk8.4 ) are slightly different
from the versions used to build ns-2.27.

..

lilicharmaine 02-17-2011 01:27 PM

Hi knudfl,

Noted, thanks :)

when I ./install for ns-allinone-2.27, I got any error message as following:

Code:

============================================================
* Build OTcl-1.8
============================================================
No .configure file found in current directory
Continuing with default options...
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc-4.4
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc-4.4 accepts -g... yes
checking for gcc-4.4 option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C preprocessor... gcc-4.4 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking for main in -lXbsd... no
checking for socket in -lsocket... no
checking for gethostbyname in -lnsl... yes
checking for dcgettext in -lintl... no
checking for getnodebyname in -ldnet_stub... no
checking standard STL is available... no
checking for tcl.h... -I../tcl8.4.18/generic
checking for tclInt.h... -I../tcl8.4.18/generic
checking for libtcl8.4... -L../tcl8.4.18/unix -ltcl8.4
checking for init.tcl... ../tcl8.4.18/library
checking for http.tcl... ../tcl8.4.18/library/http
checking Tcl http.tcl library... yes
checking for tclsh8.4.18... no
checking for tclsh8.4... /home/shiayok/ns-allinone-2.27/bin/tclsh8.4
checking for tk.h... -I../tk8.4.18/generic
checking for libtk8.4... -L../tk8.4.18/unix -ltk8.4
checking for tk.tcl... ../tk8.4.18/library
checking for X11 header files
checking for X11 library archive
checking for XOpenDisplay in -lX11... yes
checking for XShmAttach in -lXext... yes
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking system version (for dynamic loading)... Linux-2.6.35-22-generic
No explicit static compilation flag; setting V_STATIC to ""
checking for dlopen in -ldl... yes
checking for a BSD-compatible install... /usr/bin/install -c
configure: creating ./config.status
config.status: creating Makefile
rm -f libotcl.so otcl.o so_locations
gcc-4.4 -c -g -O2 -DNDEBUG -DUSE_SHM -fpic -I. -I/home/shiayok/ns-allinone-2.27/tk8.4.18/generic -I/home/shiayok/ns-allinone-2.27/tcl8.4.18/generic -I/home/shiayok/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/shiayok/ns-allinone-2.27/otcl-1.8/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/shiayok/ns-allinone-2.27/otcl-1.8/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.8 make failed! Exiting ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
=============================================================

May I know what caused these message prompted? or did I miss up
some steps? Thanks

knudfl 02-17-2011 01:34 PM

Post #159, continued answer :

.. And by the way, the 'ns-2.27-gcc410.patch' works OK with ns-allinone-2.27, no leach:
'patch < -p0 ns-2.27-gcc410.patch' outside the source ns-allinone-2.27/ .

cd ns-allinone-2.27/ && export CC=gcc-4.1 CXX=g++-4.1 && ./install

But when the LEACH files are added : make -f modified-leach-Makefile : Errors.
( Tested on Ubuntu 10.04 , 32bits.)

..

knudfl 02-17-2011 02:08 PM

Post # 161.

Are you quite sure, that all old tcl, tk, otcl, tclcl is gone ?
Renamed to back-? Moved away ? Deleted ?

All those should be replaced by the ns-allinone-2.34 versions.
Renamed or have links, that tells the old names to make the 'install'
file work. http://www.linuxquestions.org/questi...10-a-782356/#3

..

lilicharmaine 02-17-2011 02:26 PM

Hi knudfl,

yup, very sure, because I followed exactly all the steps in post #3.
But in my ns-allinone-2.27 directory, I still can see all those old folders.

In the post #163, do you means even the unused old folders need to be deleted from the ns-allione-2.27 directory?

knudfl 02-17-2011 03:14 PM

Hi lilicharmaine.

Deleting is OK, usually I just rename to back-<name>.

I don't know, why you get that error.
I checked it immediately, when you asked : No errors with "otcl-1.13"
in Ubuntu 10.10, 64bits using the default compiler.
If it is right on the edge, that it will fail / not fail, then suggest :
Edit the otcl Makefile, Makefile.in to : CC = gcc-4.3
And may be tclcl-1.19/ : CC = gcc-4.3 , CPP = g++-4.3

Also required : sudo apt-get install g++-4.3

..


All times are GMT -5. The time now is 08:22 AM.