Thursday, October 7, 2010

Install ns-2.27 in Red Hat Linux

Follow the following steps to install ns-2.27 in Red Hat Linux distribution
  1. tar -xzf *
  2. ./install
  3. Change .bash_profile and add some environment variables. put /home/zhibinwu/ns-allinone-2.27/bin:/home/zhibinwu/ns-allinone-2.27/tcl8.4.5/unix:/home/zhibinwu/ns-allinone-2.27/tk8.4.5/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
    IMPORTANT NOTICES:
    (1) You MUST put /home/zhibinwu/ns-allinone-2.27/otcl-1.8, /home/zhibinwu/ns-allinone-2.27/lib into your LD_LIBRARY_PATH environment variable.
     If it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH.
     If you are using csh, you can set it like:
     setenv LD_LIBRARY_PATH .... If you are using sh, you can set it like:
     export LD_LIBRARY_PATH=....
    
    (2) You MUST put /home/zhibinwu/ns-allinone-2.27/tcl8.4.5/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup.
    
    (3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.5
     and tk8.4.5. They are now installed under /home/zhibinwu/ns-allinone-2.27/{bin,include,lib}
    so , finally the bash_profile is like this:
    PATH=$PATH:$HOME/bin:/home/zhibinwu/ns2/ns-allinone-2.27/bin:/home/zhibinwu/ns2/ns-allinone-2.27/tcl8.4.5/unix:/home/zhibinwu/ns2/ns-allinone-2.27/tk8.4.5/unix
    
    export LD_LIBRARY_PATH=/home/zhibinwu/ns2/ns-allinone-2.27/otcl-1.8:home/zhibinwu/ns2/ns-allinone-2.27/lib
    
    export TCL_LIBRARY=/home/zhibinwu/ns2/ns-allinone-2.27/tcl8.4.5/library
    
  4. cd ns-2.27; ./validate

Note: The ns installation needs x-develop package. Otherwise, it will fail to build TCL TK.

Installation: A possible problem with CPP_NAMESPACE 
ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile,
 ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile, and
 ns-2.27/indep-utils/webtrace-conv/dec/Makefile,
 needed to be modified in order to fix a bug in ISI's distribution. The bug
 caused a compile-time error that looked like this:

 g++ -c -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -o setdest.o setdest.cc
 In file included from ../../../config.h:54,
 from setdest.h:5,
 from setdest.cc:57:
 ../../../autoconf.h:85: Error: namespace `CPP_NAMESPACE' undeclared
 setdest.cc:71:1: warning: "INFINITY" redefined
 In file included from /usr/include/math.h:40,
 from setdest.cc:43:
 /usr/include/bits/mathdef.h:35:1: warning: this is the location of the previous definition
 make[1]: *** [setdest.o] Error 1
 make[1]: Leaving directory `/home/iandow/netsim/ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest'
 make[1]: Entering directory `/home/iandow/netsim/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec'

 To fix the bug, edit ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile and 
 change this line:
 DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@
 to this line:
 DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=std

 In the other two makefiles, append -DCPP_NAMESPACE=std to CFLAGS.


REFERENCES:

[1] The Network Simulator - ns-2, http://www.isi.edu/nsnam/ns/
[2] NS news database, http://www.isi.edu/nsnam/htdig/search.html

No comments: