LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-14-2015, 09:21 AM   #1
Hataki_Kakachi
LQ Newbie
 
Registered: Oct 2015
Posts: 6

Rep: Reputation: Disabled
Issue in Leach Protocol Installation : invalid command name "Resource/Energy"


Hello guys,

I tried to install leach protocol in ns2 version 2.35 by following the steps in this link :
http://www.nsnam.com/2015/05/leach-p...in-ns2-ns.html

After completing all the steps in the link, i tried to execute the leach_test, but it shows some errors in the leach.err file :

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 "/Users/houcine/Documents/ns2/ns-allinone-2.35/ns-2.35/mit/rca/resources/ns-energy-resource.tcl" line 11)
    invoked from within
"source.orig /Users/houcine/Documents/ns2/ns-allinone-2.35/ns-2.35/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 /Users/houcine/Documents/ns2/ns-allinone-2.35/ns-2.35/mit/rca/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 "/Users/houcine/Documents/ns2/ns-allinone-2.35/ns-2.35/tcl/mobility/leach.tcl" line 19)
    invoked from within
"source.orig /Users/houcine/Documents/ns2/ns-allinone-2.35/ns-2.35/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 /Users/houcine/Documents/ns2/ns-allinone-2.35/ns-2.35/tcl/mobility/$opt(rp).tcl"
    (file "tcl/ex/wireless.tcl" line 187)
I have made a lot of research about the solution of the problem but i didn't find anything.

Any help about this issue please ?

Thank you very much.


System : MAC OS X 10.11 El Capitain
NS 2 Version : ns 2.35

NB : The installation in MAC OSX is almost like the one on Ubuntu. The only changes is the home path.

Last edited by Hataki_Kakachi; 10-14-2015 at 09:30 AM. Reason: Correction of the question's title
 
Old 10-14-2015, 09:53 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Welcome to LQ.

32bits OS : Leach does not work with ns-2.35, in any "Linux OS". EDIT : See post #7.
So probably neither with OSX. EDIT : See post #7.

The answer to ``invalid command name "Resource/Energy"`` is usually :
A failed build. Or you are using a wrong executable 'ns'.
Besides that, the "leach test" command is :
$ export RCA_LIBRARY=/home/<name>/ns-allinone-2.34/ns-2.34/mit/rca && export uAMPS_LIBRARY=/home/<name>/ns-allinone-2.34/ns-2.34/mit/uAMPS && ./test
( ./test will run ./leach_test. Please read the text files test, leach_test.)

Leach exists as some old patches for ns-2.27, and a new updated one for ns-2.34 :
leach+pegasis-ns234-files-2.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing

Leach INFO
. http://www.linuxquestions.org/questions/tags/pegasis/
. http://www.linuxquestions.org/questions/tags/leach/

Build example, the recommended CentOS 6.7 :
http://www.linuxquestions.org/questi...ch-4175524367/


-

Last edited by knudfl; 10-15-2015 at 11:47 AM.
 
Old 10-14-2015, 10:09 AM   #3
Hataki_Kakachi
LQ Newbie
 
Registered: Oct 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
@Knudfl : Thank you for your quick reply .

The link that i followed for the installation contains a video with the execution of leach protocol on ns 2.35 and it works perfectly .

For the export RCA_LIBRARY ..... commands, the paths are already added to the .bash_profile file ( equivalent of the .bashrc file on Linux) .
Moreover , i don't have the test file in my case, i've only the leach_test file . and it is the file that is used by the guy in the video to test the leach protocol.

the installation steps and the build of the leach protocol are all done in my case, but the error is always there.

You mean by the "wrong executable ns" that the installation of ns2 on Mac OS X is not done successfully ?

Thank you and sorry for disturbing you.
 
Old 10-14-2015, 02:02 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #3.

Well, I gave it another try with the "pradeepkumar" files.
Code:
$ ./leach_test
... which supplies the usual ns-2.35 error in mit/leach_sims/leach.err :
EDIT : See post #7.
Code:
INITIALIZE THE LIST xListHead
Error!!
str2addr:Address 2147483647 outside range of address field length 1073741824
Unlike ns-2.34, where you get the right text in leach.err :
Code:
mac/chanel.cc: INITIALIZE THE LIST xListHead
SORTING LISTS ...DONE!
... And you get all the other output files too, with a text.


-

Last edited by knudfl; 10-15-2015 at 11:49 AM.
 
1 members found this post helpful.
Old 10-14-2015, 05:06 PM   #5
Hataki_Kakachi
LQ Newbie
 
Registered: Oct 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Re #3.


@knudfl : Thank you . So the solution is to have ns2.34 instead of ns 2.35 isn't it ? and the best OS is to use ubuntu instead of MAC OS X ?

Last edited by Hataki_Kakachi; 10-14-2015 at 05:35 PM.
 
Old 10-14-2015, 05:18 PM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #5 : Please do not quote entire posts. A "one word reference" will do.


Ubuntu ? See post #2 : Recommended is CentOS 6.7 - i386 : EDIT : See post #7
http://ftp.funet.fi/pub/mirrors/cent...386-LiveCD.iso
>> CentOS-6.7-i386-LiveCD.iso

( If you insist in Ubuntu : Ubuntu 10.04 or earlier can be used too.)


-

Last edited by knudfl; 10-15-2015 at 11:51 AM.
 
1 members found this post helpful.
Old 10-15-2015, 09:33 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
ns-2.35 + LEACH is OK with a 64bits OS

About ns-2.35 + LEACH : Works with a 64bits OS only.
( My test : CentOS 6.7 - x86_64 ).

Your OSX may be OK with {ns-2.35 + LEACH}, if it's a 64bits OS.

----

The only "issue" I can spot is that no file leach.alive.txt is created.
May be there is an awk solution for that ?
"leach.alive.txt" is useful for running $ xgraph leach.alive.txt &


-
 
Old 10-15-2015, 09:45 AM   #8
Hataki_Kakachi
LQ Newbie
 
Registered: Oct 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
@knudfl : Re Post #7

My OS X is a 64 bits .

Could you please send me your skype name in a private message in order to help me about this issue ? We can use teamviewer to let you verify all files of the LEACH protocol.

Thank you very much.
 
Old 10-15-2015, 09:50 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
RE #7.

Found an awk script ...
http://www.cnblogs.com/reaver21/arch...6/2354559.html

Attached as "leach__nodes-alive.awk.txt".

Usage : $ awk -f leach__nodes-alive.awk leach.alive >> leach.alive.txt
-
Attached Files
File Type: txt leach__nodes-alive.awk.txt (589 Bytes, 236 views)

Last edited by knudfl; 10-17-2015 at 05:43 PM.
 
Old 10-15-2015, 09:56 AM   #10
Hataki_Kakachi
LQ Newbie
 
Registered: Oct 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Re #9 : Thank you @Knudfl

Where should i paste the attached file you gave to me ? is it on the leach sims/ folder ? and then i must execute the command you gave me ?

Thank you and sorry for disturbing you, i'm a newbie in ns2 and this stuff
 
Old 10-15-2015, 10:10 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #9, and ref. my answers here today ...
http://www.nsnam.com/2015/05/leach-p...in-ns2-ns.html
( Makefile.in issues, etc.)

The edited "pradeepkumar files" are available as : leach_ns235_Oct2015.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
And as a genuine patch : leach_ns235-Jun2015.patch
https://drive.google.com/file/d/0B7S...ew?usp=sharing

Using : $ tar xvf ns-allinone-2.35_gcc482.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
(ns-allinone-2.35_gcc482 is the `Oct 2014' update, for all gcc/g++ versions 4.4 .. 5.2).
$ cd ns-allinone-2.35/
$ tar xvf leach_ns235_Oct2015.tar.gz
( Or : $ patch -p0 < leach_ns235-Jun2015.patch )
$ ./install
$ cd ns-2.35/
$ sudo make install
$ ./leach_test

( Before you can do './leach_test', you will still have to find all "pradeepkumar" text in ns-2.35/ :
$ grep -Rn pradeepkumar *
.... and replace `pradeepkumar' with your own path : 25 lines in 9 files.)

------

That's it. That short "instruction" is the way to do ns-2.35 + LEACH !
Will probably solve any issues you may have experienced.


-

Last edited by knudfl; 10-15-2015 at 11:57 AM.
 
Old 10-15-2015, 10:54 AM   #12
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #10.

""Where should I paste the attached file"" : Wherever you like.

The command 'awk -f leach__nodes-alive.awk leach.alive >> leach.alive.txt' ...
is when the files are present in the same directory. Which one doesn't matter.


-

Last edited by knudfl; 10-17-2015 at 05:35 PM.
 
Old 10-15-2015, 01:30 PM   #13
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #11, "Using".

ns-2.35 + LEACH works OK too with a contemporary 64bits Ubuntu OS.

My test : Ubuntu 15.04 - x86_64.
 
Old 12-05-2015, 05:57 AM   #14
Bird2015
LQ Newbie
 
Registered: Dec 2015
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
Re #11, "Using".

ns-2.35 + LEACH works OK too with a contemporary 64bits Ubuntu OS.

My test : Ubuntu 15.04 - x86_64.
Hi sir,I am a newer,I use Ubuntu15.10 , ns-allinone-2.35_gcc482.tar.gz and leach-Octo2015,
when I do "make",there is trouble
./config.h:60:19: fatal error: tclcl.h:...
compilation terminated.
Makefile:88: recipe for target 'tools/random.o' failed
make:*** [tools/random.o] Error 1

Could you help me?
I want to use leach on ns-2.35.
Thank You!
 
Old 12-05-2015, 06:17 AM   #15
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Post #14, @Bird2015 : Welcome to LQ.

? May be the Ubuntu 15.10 gcc/g++ -5.2 is patched to be unusable with ns2 ?

You can just use one of the other default Ubuntu 15.10 compilers (4.7, 4.8, 4.9) :
$ sudo apt-get update && sudo apt-get install g++-4.9
$ cd ns-allinone-2.35/ (assume patched with leach_ns235-Jun2015.patch or leach-Oct2015)
$ export CC=gcc-4.9 CXX=g++-4.9 && ./install



-

Last edited by knudfl; 12-05-2015 at 06:21 AM.
 
  


Reply

Tags
leach, leach ns235, ns2



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
problem with running leach protocol in ns2.34 leach.er Mohamed69 Linux - Software 14 04-16-2018 07:10 AM
LEACH protocol installation on NS2.27 lubelube Linux - Software 50 04-18-2013 05:02 AM
LEACH protocol installation on NS2.27 Scofield Linux - General 255 03-08-2012 05:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:35 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
Open Source Consulting | Domain Registration