Monday, February 28, 2011

Install ns-allinone-2.35 in fedora 14

NS2 stands for network simulator and it is not in fedora repository but it's allinone package is available on isi.edu recently ns-2.35 RC7 is there with updated tcl and tk library but still it is not support gcc-4.5 series (does not like the X::X() construct) so i made 2 patches.

Download links :
patch 1
patch 2


After apply those patches you can follow below steps.


Install Dependences :
yum install autoconf
yum install automake
yum install gcc-c++
yum install libX11-devel
yum install xorg-x11-proto-devel
yum install libXt-devel
yum install libXmu-devel

Build ns-allinone-2.35
Go to you download directory and extract package (tar -xvf tarball), go to extracted directory and run
#./install


Validate ns-2.35
Go to ns-2.35 directory and run
#./validate (take almost 1 hour so keep patience)


Add PATH in .bashrc
vim ~/.bashrc
Add the following lines to the end of it. Remember replace “/opt/” by your installation path like “/home/username”. And accordingly also change the version numbers. This is for ns 2.35.

# LD_LIBRARY_PATH
OTCL_LIB=/opt/ns-allinone-2.35-RC7/otcl-1.14
NS2_LIB=/opt/ns-allinone-2.35-RC7/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=/opt/ns-allinone-2.35-RC7/tcl8.5.8/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/opt/ns-allinone-2.35-RC7/bin:/opt/ns-allinone-2.35-RC7/tcl8.5.8/unix:/opt/ns-allinone-2.35-RC7/tk8.5.8/unix
NS=/opt/ns-allinone-2.35-RC7/ns-2.35/
NAM=/opt/ns-allinone-2.35-RC7/nam-1.15/
PATH=$PATH:$XGRAPH:$NS:$NAM



Logout/reboot your system and its done ... enjoy ... :)

25 comments:

Stella said...

Have you managed to solve the problem with fedora 14 and ns-allinone-2.30?
I've got the same

Praveen Kumar said...

I did not try out lower version of ns2.Please check the GCC version.

Arun said...

Are you able to run the program?
I am getting buffer overflow error

Praveen Kumar said...

Yes I run it successfully without any error.

Unknown said...

how to apply patches?

Praveen Kuamr said...

patch [option] < patchfile_name
Please go through patch manual for more information (man patch)

Unknown said...

may I try ns2.35 in fedora 13 in same way ?

Praveen Kuamr said...

Well i never tried it on fedora-13 but i think it's work on f-13 also as long as your gcc version is correct. (if you able to install succfully please let me update also)

Unknown said...

ya sure ! ! bt i able to successfully install ns2.35 in fedora 14 without applying those patches .. as i cant understand till now how to apply patches.

i copy two patches and save it like patch1.patch and patch2.patch at opt/ns-allinone-2.35/ns-2.35/tools or mobile directory.
after this i go to opt/ns-allinone-2.35/ns-2.35/tools directory and enter
$ patch -p1 <patch1.patch
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
-------------------------- |--- ranvar.cc 2010-09-06 05:03:04.000000000 +0530
|+++ /home/sangita/ns-allinone-2.35/ns-2.35/tools/ranvar.cc 2011-02-27 20:10:53.633796000 +0530
--------------------------
File to patch:
now i became confused what to do..

so I go without applying patches for fedora 14, it is running fine.. now i will try to install in fedora 13..
can u plz describe me how to apply those patch ?

Praveen Kuamr said...

No, you can create a patch using diff and redirect it to .patch so there is no point to use any patch command options.

Yes, May be upstreamer already updated the code that's why it's installed without patch.

Check you gcc version in f-13 and if it is same as f-14 then I don't think you need to apply patch.

Note : f-13 and f-14 is now EOL (End of life) so there is no support for that, please upgrade your system to f-16.

Unknown said...

fedora 13 ~~ gcc version 4.4.5
fedora 14 ~~ gcc version 4.5.1

should i apply patch for fedora 13 ?

Praveen Kuamr said...

Check if you able to build without applying patch, if not then apply :)

I posted it long back and now I am also not using ns, so I am not aware of most of the problem which may you face during building, their is a good ns mailing list, you can post your query their.

Unknown said...

I'm able to install NS2 in both fedora 13 and 14 successfully..
thankz a lot ! !

zakir said...

i installed ns2.34 on fedora 13 successfully 2 times. but when i close the terminal and then i start terminal and type ns2, then it is not working. it gives the following error.
[root@localhost Zakir]# ns
Command not found. Similar command is: 'nc'

Praveen Kuamr said...

Did you add your ns bin path to bashrc? because as your output showing it doesn't in your PATH. just run "echo $PATH" to check you executable files.

zakir said...

yes sir i give path, it is the output of echo $PATH, kindly guide me how to give path, that i correct my installation.
[root@localhost bin]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/ns-allinone-2.34-RC7/bin:/opt/ns-allinone-2.34-RC7/tcl8.5.8/unix:/opt/ns-allinone-2.34-RC7/tk8.5.8/unix:/opt/ns-allinone-2.34-RC7/ns-2.34/:/opt/ns-allinone-2.34-RC7/nam-1.15/:/home/Zakir/bin:/opt/ns-allinone-2.34-RC7/bin:/opt/ns-allinone-2.34-RC7/tcl8.5.8/unix:/opt/ns-allinone-2.34-RC7/tk8.5.8/unix:/opt/ns-allinone-2.34-RC7/ns-2.34/:/opt/ns-allinone-2.34-RC7/nam-1.15/:/opt/ns-allinone-2.34-RC7/bin:/opt/ns-allinone-2.35-RC7/tcl8.5.8/unix:/opt/ns-allinone-2.35-RC7/tk8.5.8/unix:/opt/ns-allinone-2.34-RC7/ns-2.34/:/opt/ns-allinone-2.34-RC7/nam-1.15/
[root@localhost bin]#

zakir said...

Thank You Sir, i was not set that path you told me.
my problem is soloved.

Abraham Dinakaran said...

I am not able to patch hls in ns-2.33 i am getting an error
patch: **** rejecting target file name with ".." component: ../ns-2.33-hls_working/ns-2.33/common/agent.h

Abraham Dinakaran said...

I am using fedora 13

Praveen Kuamr said...

I don't know on which files you are applying those patches, better go step by step as described.
Note: fedora-13 is obsolete now, use latest fedora version. Also use latest ns2 package, I hope then you don't need to patch stuff.

pranav said...
This comment has been removed by the author.
pranav said...

sir how to patch those two files before installation of ns2 2.35 in fedora 14

Vijay Jan said...

AFTER I TYPE YUM INSTALL AUTOCONF I GOT AN ERROR THAT "CANNOT RETRIEVE METALINK FOR REPOSITORY:FEDORA/18/X86_64. PLEASE VERIFY ITS PATH AND TRY AGAIN" SO I DONT KNOW WAT TO DO PLEASE HELP ME

Praveen Kuamr said...

@Vijay: Have a look at https://ask.fedoraproject.org/question/9290/yum-update-error-cannot-retrieve-metalink-for-repository-fedora/

pranav said...

when i give ./install in fedora 14(ns-2.35) it is showing
tools/ranvar.cc:562:3: error: expected unqualified-id before ‘if’
make: *** [tools/ranvar.o] Error 1
Ns make failed!