LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   NS-2.27 on Ubuntu 12.04 (https://www.linuxquestions.org/questions/linux-newbie-8/ns-2-27-on-ubuntu-12-04-a-4175486784/)

mhmdmahdi 12-04-2013 01:19 AM

NS-2.27 on Ubuntu 12.04
 
Hi all,
Need quick answer, can I install NS-2.27 on Ubuntu 12.04?
I have Ubuntu 12.04 i686 with gcc 41 & g++ 41 installed.
I have followed all thread related to NS-2.27 installation but can't find the answer, and I also have tried to install with the guide for Ubuntu 9.10 but failed due to gcc issue.

If I can't use NS-2.27 on Ubuntu 12.04, please let me know what ubuntu distro can run ns-2.27 without problem.

I need NS-2.27 to run Leach simulation.
Please don't tell me to use NS-2.34, I am facing problem running Leach on NS-2.34 that drives me crazy :)

--------------------------------------------
Dear Sir knudfl, need your help.
Please answer if you found this thread :)

knudfl 12-04-2013 03:53 AM

Ubuntu 12.04 - i686 is one of the easy ones :
1. $ tar xvf ns-allinone-2.27.tar.gz && patch -p0 < ns-2.27-gcc410.patch
2. $ cd ns-allinone-2.27/ && export CC=gcc41 CXX=g++41 && ./install

The older Ubuntu versions are complicated (but no gcc issues !) :
* Please read http://www.linuxquestions.org/questions/tags/ns227/
→ #3 http://www.linuxquestions.org/questi...10-a-782356/#3

Leach info http://www.linuxquestions.org/questions/tags/leach/
Leach Makefile.in http://www.linuxquestions.org/questi...atch-791222/#4
→ post #4.

-

mhmdmahdi 12-04-2013 04:28 AM

Hi knudfl, thanks for helping.
a little confused about Makefile.
after successfully install NS 2.27, if i use 1-LEACH-Makefile-modified to re-make NS, do I need to remove original Makefile?


Quote:

Originally Posted by knudfl (Post 5075135)
Ubuntu 12.04 - i686 is one of the easy ones :
1. $ tar xvf ns-allinone-2.27.tar.gz && patch -p0 < ns-2.27-gcc410.patch
2. $ cd ns-allinone-2.27/ && export CC=gcc41 CXX=g++41 && ./install

-


mhmdmahdi 12-04-2013 05:01 AM

-- update ---

After successfully install NS 2.27, i do this step:

$ cd ns-allinone-2.27/ns-2.27/
$ tar xvf mit.tar.gz
$ ./configure
$ mv Makefile Makefile.org
$ make clean
make: *** No rule to make target `clean'. Stop.
$ make -f 1-LEACH-Makefile-modified

but got this error.

Quote:

...
./mac/mac.h:142: warning: ‘class Tap’ has virtual functions but non-virtual destructor
./mac/mac.h:150: warning: ‘class MacHandlerResume’ has virtual functions but non-virtual destructor
./mac/mac.h:158: warning: ‘class MacHandlerSend’ has virtual functions but non-virtual destructor
tclsh8.4 bin/tcl-expand.tcl tcl/lib/ns-lib.tcl tcl/lib/ns-diffusion.tcl | tcl2c++ et_ns_lib > gen/ns_tcl.cc
/bin/sh: 1: tclsh8.4: not found
/bin/sh: 1: tcl2c++: not found
make: *** [gen/ns_tcl.cc] Error 127
Any hints how to solve this?

I changed 1-LEACH-Makefile-modified before run "make -f 1-LEACH-Makefile-modified"
CC=gcc41
CPP=g++41
/home/Administrator/ns-allinone-2.27/ --> /home/mhmdmahdi/ns-allinone-2.27/

knudfl 12-04-2013 05:17 AM

#3, #4.
Quote:

$ cd ns-allinone-2.27/ns-2.27/
$ tar xvf mit.tar.gz
$ ./configure
$ mv Makefile Makefile.org
$ make clean
make: *** No rule to make target `clean'. Stop.
$ make -f 1-LEACH-Makefile-modified
"./configure" is wrong : $ export CC=gcc41 CXX=g++41 && ./configure
And don't use the old Makefile's.

There is a reason for the new LEACH `Makefile.in'.
Then you don't have to edit the Makefile :
cd ns-allinone-2.27ns-2.27/ && export CC=gcc41 CXX=g++41 && ./configure
* Which create a Makefile that fits your OS / ns-allinone-2.27/lib/* etc.

The proof way is of course to put everything leach : {mit/ Makefile.in}
in place in a fresh unpacked ns-allinone-2.27.tar.gz, and do the build
commands : $ patch -p0 < ns-2.27-gcc410.patch
$ cd ns-allinone-2.27/ && export CC=gcc41 CXX=g++41 && ./install

-

mhmdmahdi 12-04-2013 05:41 AM

$ export CC=gcc41 CXX=g++41 && ./configure
$ make clean
$ make

got this error :confused:

Quote:

...
mac/wireless-phy.cc: In member function ‘virtual void WirelessPhy::sendDown(Packet*)’:
mac/wireless-phy.cc:320: error: ‘min’ was not declared in this scope
make: *** [mac/wireless-phy.o] Error 1

knudfl 12-04-2013 06:24 AM

# 6 .
Quote:

$ export CC=gcc41 CXX=g++41 && ./configure
$ make clean
$ make
Probably :
$ make distclean && export CC=gcc41 CXX=g++41 && ./configure && make

? Are you sure that the new **Makefile.in.txt was renamed to Makefile.in,
and copied to ns-allinone-2.27/ns-2.27/ ?

-

mhmdmahdi 12-04-2013 06:57 AM

i'm sorry sir,
the errors gone, just need to add a line in wireless-phy.cc

#define min(a,b) (((a)>(b))?(b): (a))

but still got weird leach.out related to "Warning!!! No Cluster Head ADVs were heard!" issues.
have no idea why this is happen, I think something prevent the simulation to running well on my computer. :doh:
looking to downgrade my OS now, i hope that can solve my problem. :(
any suggestion what distro i should use?

Quote:

Originally Posted by knudfl (Post 5075190)
# 6 .

Probably :
$ make distclean && export CC=gcc41 CXX=g++41 && ./configure && make

? Are you sure that the new **Makefile.in.txt was renamed to Makefile.in,
and copied to ns-allinone-2.27/ns-2.27/ ?

-



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