LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to integrate the "Resource/Energy" leach class into NS-2.34? (https://www.linuxquestions.org/questions/linux-software-2/how-to-integrate-the-resource-energy-leach-class-into-ns-2-34-a-870368/)

magicbullet 05-05-2011 10:37 AM

Quote:

Originally Posted by knudfl (Post 4347106)
@magicbullet, post # 12 : Welcome to LQ.

No gcc-4.3 for Ubuntu 11.04, but you can then use gcc-4.2.
( gcc-4.1 and gcc-3.4 (gcc-3.3) will usually work perfect too.

Add hardy to etc/apt/sources.list, as described in post # 2.
( sudo gedit etc/apt/sources.list ).


And then ..
sudo apt-get update && sudo apt-get install g++-4.2 gcc-4.2

..

I've tried that but failed with the following error:

============================================================
* Build tcl8.4.18
============================================================
configure: WARNING: unrecognized options: --enable-gcc
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc-4.2
checking whether the C compiler works... no
configure: error: in `/home/wilson/Documents/ns-allinone-2.34/tcl8.4.18/unix':
configure: error: C compiler cannot create executables
See `config.log' for more details
tcl8.4.18 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.

I did this: export CC=gcc-4.2 CXX=g++-4.2 && ./install

Before this, I have installed other gcc versions like 4.3, 3.3 but they all failed as well

It seems all the gcc versions cannot compile, i.e. "checking whether the C compiler works... no"

knudfl 05-05-2011 10:49 AM

@magicbullet, post # 16.

'sudo apt-get install g++ g++-4.2' , etc. etc.

GCC cannot be used for very much alone.
You will have to install the g++** for all versions :
g++ insures that the files required by gcc also will get installed.

EDIT : See post # 22

..

magicbullet 05-05-2011 10:58 AM

Quote:

Originally Posted by knudfl (Post 4347490)
@magicbullet, post # 16.

'sudo apt-get g++ g++-4.2' , etc. etc.

GCC cannot be used for very much alone.
You will have to install the g++** for all versions :
g++ insures that the files required by gcc also will get installed.

U mean I need to do: sudo apt-get install g++-4.2 gcc-4.2 ?
Anything else? Anyhow, by doing: sudo apt-get install g++-4.2 gcc-4.2, I still get the same error.

I also did the following:

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.2 /usr/bin/gcc
export CC=gcc-4.2 CXX=g++-4.2 && ./install

Same error

knudfl 05-05-2011 11:21 AM

#18
Quote:

... I need to do: sudo apt-get install g++-4.2 gcc-4.2 ?
Not really. No reason to write gcc-4.2. gcc** will always be installed
for dependency, when you type g++*.


But there are problems with the older compilers in Ubuntu 11.04.
Versions 3.3 , 3.4 , 4.2 don't work here either : Ubuntu 11.04, 64bits.

I will look for a solution.
And please tell, if you have a 64bits OS. The command : 'uname -a' will show.

magicbullet 05-05-2011 11:26 AM

Quote:

Originally Posted by knudfl (Post 4347511)
#18
Not really. No reason to write gcc-4.2. gcc** will always be installed
for dependency, when you type g++*.


But there are problems with the older compilers in Ubuntu 11.04.
Versions 3.3 , 3.4 , 4.2 don't work here either : Ubuntu 11.04, 64bits.

I will look for a solution.
And please tell, if you have a 64bits OS. The command : 'uname -a' will show.

Thanks! The command shows : 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux

magicbullet 05-05-2011 12:17 PM

Quote:

Originally Posted by knudfl (Post 4347511)
#18
Not really. No reason to write gcc-4.2. gcc** will always be installed
for dependency, when you type g++*.


But there are problems with the older compilers in Ubuntu 11.04.
Versions 3.3 , 3.4 , 4.2 don't work here either : Ubuntu 11.04, 64bits.

I will look for a solution.
And please tell, if you have a 64bits OS. The command : 'uname -a' will show.

I have tried with 4.3 . It solved the above problem. However, I got the following error:

/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
make: *** [tcl2c++] Error 1
tclcl-1.19 make failed! Exiting ...

knudfl 05-05-2011 05:24 PM

# 20-21.
Quote:

i686 i686 i386
That's a 32bits OS.


There seems to be a workaround for the 32bits Ubuntu 11.04 (Not 64bits) :
cd /usr/local/lib/ &&
sudo ln -s /lib/i386-linux-gnu/libgcc_s.so.1 libgcc_s.so

cd /usr/local/include/ && sudo ln -s /usr/include/i386-linux-gnu/asm/

Works with : export CC=gcc-4.2 CXX=g++-4.2 && ./install
( 4.3 should be OK too. Where did you get the "4.3" ? )

..

magicbullet 05-05-2011 07:53 PM

Quote:

Originally Posted by knudfl (Post 4347801)
# 20-21.

That's a 32bits OS.


There seems to be a workaround for the 32bits Ubuntu 11.04 (Not 64bits) :
cd /usr/local/lib/ &&
sudo ln -s /lib/i386-linux-gnu/libgcc_s.so.1 libgcc_s.so

cd /usr/local/include/ && sudo ln -s /usr/include/i386-linux-gnu/asm/

Works with : export CC=gcc-4.2 CXX=g++-4.2 && ./install
( 4.3 should be OK too. Where did you get the "4.3" ? )

..

Thanks. It works now!

Btw, how do I remove all the linkages, i.e. sudo ln -s /lib/i386-linux-gnu/libgcc_s.so.1 libgcc_s.so and sudo ln -s /usr/include/i386-linux-gnu/asm/?

knudfl 05-06-2011 02:24 AM

# 23

cd /usr/local/lib/ && sudo rm libgcc_s*

cd /usr/local/include/ && sudo rm -r asm/

keepwalking 05-06-2011 08:39 AM

Hello every body
may any one help me to change this pseudo code to and real protocol I m not familiar with C++
Code:

Initialization
{
Find average energy of n nodes
Find the distance of each node
Calculate whether node is eligible as Cluster Head (ch node)
Select x nodes where x < n as the candidate of Cluster Head
43
}
Find m as total chromosome, where m=x nodes/desired p cluster
Populate m Chromosome
For i=0, i<m, i++
{
Randomly choose nodes from x nodes
If y < p
Add nodes to chromosome C at y
else
y=0
}
For each p chromsome
{
Do
{
For each Chromosome k where k<=p
{
Find the Chromosome Fitness
Find the Chromosome probability
}
Find average probability
Find best Chromosome as Parent 1
Do Roulette
{
Determine r where 0 < r < 1
If probability Chromosome i > r
Select Chromosome ith as second parent
Break roulette
Else
Continue Roulette
}
44
Do Crossover parent 1 and parent 2
Crossover result as Children 1 and Children 2
Mutation between least Probability Chromosome with Children
} Until iteration=k
Select the best chromosome as a group of Cluster Head (CH0,CH1,CH3,…,CHn)
Determine Cluster Head for each nodes, where d(CHi)<< from each nodes
Inform to all nodes about their Cluster head


vaan 05-07-2011 10:16 PM

same question~
 
Quote:

Originally Posted by melokuhle (Post 4347173)
Hello every body

when I'm using the make command I get the following error:
Code:

trace/cmu-trace.cc: In member function ‘void CMUTrace::format(Packet*, const char*)’:
trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope
trace/cmu-trace.cc: At global scope:
trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’
make: *** [trace/cmu-trace.o] Error 1
luuh@ubuntu:~/ns-allinone-2.34/ns-2.34$ ns
ns: command not found

can any one help me to to solve this problem.

same question ,any one help? Thank you ~

leminh1009 05-09-2011 09:50 AM

Hi MayTamer,

Could you please advise me how to download "leach-setup.sh" file from your link provided? When i clicked that link, it doesn't work at all.

Thank in advance.

knudfl 05-09-2011 11:30 AM

# 27, @leminh1009.

The link works OK here. However, I have uploaded the files too
some time ago, to provide a "second source".

leach-setup234.sh = leach-setup.sh
https://docs.google.com/uc?id=0B7S25...download&hl=en

ns234-leach-042011.tar.bz2 = ns-234-leach.tar.gz
https://docs.google.com/uc?id=0B7S25...download&hl=en

..

deepa_2111 05-10-2011 07:10 PM

You need to add a declaration of format_rca in cmu-trace.h
Code:

        void    format_imep(Packet *p, int offset);
        void    format_aodv(Packet *p, int offset);
        void    format_aomdv(Packet *p, int offset);
#ifdef MIT_uAMPS
        void    format_rca(Packet *p, int offset);
#endif

        // This holds all the tracers added at run-time
        static PacketTracer *pktTrc_;

};

This should help solve your issue

Quote:

Originally Posted by melokuhle (Post 4347173)
Hello every body


when I'm using the make command I get the following error:
Code:

trace/cmu-trace.cc: In member function ‘void CMUTrace::format(Packet*, const char*)’:
trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope
trace/cmu-trace.cc: At global scope:
trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’
make: *** [trace/cmu-trace.o] Error 1
luuh@ubuntu:~/ns-allinone-2.34/ns-2.34$ ns
ns: command not found

can any one help me to to solve this problem.



---------- Post added 05-10-11 at 08:11 PM ----------


deepa_2111 05-11-2011 08:17 AM

Please see my reply on Post #29

Quote:

Originally Posted by vaan (Post 4349690)
same question ,any one help? Thank you ~



All times are GMT -5. The time now is 06:33 PM.