Wednesday, 22 February 2017

Steps for conducting the experiment


General Instructions


Follow are the steps to be followed in general to perform the experiments in Advanced Network Technologies Virtual Lab.

  1. Read the theory about the experiment
  2. View the simulation provided for a chosen, related problem
  3. Take the self evaluation to judge your understanding (optional, but recommended)
  4. Solve the given list of exercises

Experiment Specific Instructions


In the theory part we have learned how to work with NS2. In this section we now learn how to make your system ready so that you can work with Network Simulator 2.NS2 is a open source software. It can be downloaded from Internet and installed.

Basic Requirements:

  • A computer which is having access to the Internet
  • Minimum 512Mb RAM
  • Operating system: Linux(Ubuntu 10.04)
  • ns-2.34 package
  • gcc-4.4.3
  • make tools

The following instructions for downloading and installing ns2 are for a system with:

  • Operating System: Linux (Ubuntu 10.04)
  • ns2: 2.34
  • gcc: 4.4.3

Some of the known problems that have been faced during installation as well as their solutions have been discussed in one of the sections below.
The steps for installation should ideally be applicable for other version and/or configuration of Linux also. Any other problem that might arise would require further troubleshooting.

Downloading ns-2.34


To download ns2 go to http://www.isi.edu/nsnam/ns/ns-build.html. Here you can download the ns all-in-one package or you can download the packages separately.

Well, lets learn how to download the packages separately.

  1. First go to http://www.isi.edu/nsnam/ns/ns-build.html.
  2. Then download Tcl and Tk from http://www.tcl.tk/software/tcltk/downloadnow84.tml [note: the versions of Tcl and Tk must be same.]
  3. Download OTcl from: http://sourceforge.net/projects/otcl-tclcl/files/OTcl/1.13/
  4. Download Tclcl from : http://sourceforge.net/projects/otcl-tclcl/files/TclCL/1.19/
  5. Download ns-2 from :http://sourceforge.net/projects/nsnam/files/ns-2/2.34/
  6. Download nam from :http://sourceforge.net/projects/nsnam/files/nam-1/1.14/ [note : download only nam-1.14.tar.gz not ns-allinone package.]
  7. Download xgraph from: http://sourceforge.net/projects/nsnam/files/xgraph/xgraph-12.1/

Note: there are some other few things to be downloaded but that depends upon your requirement.For example, if some error occurs for absence of any package,then you need to detect the error and download the required package.

Installation


Here we will install the the packages separately

  1. All the files will be zip format.So at first you need to unzip all the files. the command to unzip the files:

  2. tar -xzvf <file_name>

    for e.g if we want to unzip the Tcl package the type: tar -xzvf tcl8.4.19
    To unzip all the files together use the following command:

    for ifile in ` ls *.tar.gz`
    do
    ar -xzvf $ifile
    done

  3. Next, we will install Tcl.The command required is:
  4. cd tcl8.4.19
    ls
    cd unix
    ./configure
    make
    sudo make install

  5. Install Tk:
  6. cd tk8.4.19
    ls
    cd unix
    ./configure
    make
    sudo make install

  7. Install OTcl:
  8. cd otcl-1.13
    /configure --with-tcl=../tcl8.4.19 #note-while configuring we need to specify the path of tcl
    make
    sudo make install

  9. Install Tclcl-1.19:
  10. cd tclcl-1.19
    ./configure --with-tcl=../tcl8.4.19 #note-while configuring we need to specify the path of tcl
    make
    sudo make install

  11. Install ns-2.34:
  12. cd ns-2.34
    /configure --with-tcl=../tcl8.4.19
    make
    sudo make install

  13. Install NAM:
  14. cd nam-1.14
    ./configure --with-tcl=../tcl8.4.19
    make
    sudo make install 

  15. Install xgraph: 
  16. cd xgraph-12.1
    ./configure
    make
    sudo make install

Probable problems that could appear while installing the packages and their solution


1. Tk was installed properly but it failed to run somehow.

How to identify this:

After installing tk8.4.19 try to run the script tk8.4.19/unix/wish from the terminal.A small window will open,close it. If no error messages appears in the terminal then Tk installation is successful and Tk is working properly. This can also be verified after installing nam and then trying to run nam. The error message would be something like:

nam:
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."

Solution:


If you get error messages then download the patch files tk-8.4.18-tkBind.patch and tk-8.4-lastevent.patch from http://bugs.gentoo.org/show_bug.cgi?id=225999.

then copy those files into Tk directory.Now apply the patches by using the following command:

  1. patch -p1 < tk-8.4.18-tkBind.patch
  2. patch -p1 < tk-8.4-lastevent.patch

If fail to apply the patches then open the patch, check the name of the file to be patched, and make the relevant modifications to that file accordingly.

Note: the contents of the original file are shown with a minus(-) sign at the beginning.The modified contents do begin with a plus(+) sign. The contents of the two patch files are shown below for easy reference:

--- tk8.4.18-orig/generic/tkBind.c 2006-07-21 08:26:54.000000000 +0200
+++ tk8.4.18/generic/tkBind.c 2008-07-05 12:17:10.000000000 +0200
@@ -586,6 +586,9 @@
/* ColormapNotify */                                 COLORMAP,
/* ClientMessage */                                  0,
/* MappingNotify */                                    0,
+#ifdef GenericEvent
+ /* GenericEvent */                                 0,
+#endif
/* VirtualEvent */                                        VIRTUAL,
/* Activate */                                               ACTIVATE,
/* Deactivate */                                          ACTIVATE,

and

--- generic/tk.h.orig                     2008-02-06 16:31:40.000000000 +0100
+++ generic/tk.h                          2008-07-24 08:21:46.000000000 +0200
@@ -635,17 +635,15 @@
*
*---------------------------------------------------------------------------
*/
-#define VirtualEvent                (LASTEvent)
-#define ActivateNotify              (LASTEvent + 1)
-#define DeactivateNotify         (LASTEvent + 2)
-#define MouseWheelEvent    (LASTEvent + 3)
-#define TK_LASTEVENT       (LASTEvent + 4)
+#define VirtualEvent               (MappingNotify + 1)
+#define ActivateNotify             (MappingNotify + 2)
+#define DeactivateNotify       (MappingNotify + 3)
+#define MouseWheelEvent   (MappingNotify + 4)
+#define TK_LASTEVENT       (MappingNotify + 5)

#define MouseWheelMask       (1L << 28)
-
#define ActivateMask                  (1L << 29)
#define VirtualEventMask          (1L << 30)
-#define TK_LASTEVENT        (LASTEvent + 4)

/*
After doing all these stuffs, do install Tk from beginning again and also verify whether 'wish' runs properly(as indicated above).

2. Problem while running 'make' for OTcl

otcl.o: In function `OTclDispatch':
/home/barun/Desktop/ns2/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/barun/Desktop/ns2/otcl-1.13/otcl.c:2284: undefined reference to `__stack_chk_fail_local'
ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Nonrepresentable section on output
make: *** [libotcl.so] Error 1

Solution:

  1. goto the 'configure' file
  2. In line no. 5516

SHLIB_LD="ld -shared"
change the above to
SHLIB_LD="gcc -shared"
for further information you can gob to http://nsnam.isi.edu/nsnam/index.php/User_Information

3. Problem wile running ' sudo make install' for ns-2.34

ns: error while loading shared libraries: libotcl.so: cannot open shared object file: No such file or directory

Solution:

We need to set the following environment variables, and store them in the ~/.bashrc file.
 1    OTCL_LIB=/your/path/ns-2.34/otcl-1.13
2    NS2_LIB=/your/path/ns-2.34/lib
3    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB
Now open a new terminal, and type ns. This should now work without any error.

4. Problem while running 'make' for nam

rm -f tkcompat.o; gcc -o tkcompat.o -c -Wall -Wno-write-strings -DTCL_TK -DNO_VOID -DNDEBUG -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_13 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCLINT_H -DHAVE_TCL_H -I. -I/home/bibudhendu/Desktop/ns2/tclcl-1.19 -I/home/bibudhendu/Desktop/ns2/otcl-1.13 -I/usr/local/include -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic tkcompat.c

rm -f tkUnixInit.o; gcc -o tkUnixInit.o -c -Wall -Wno-write-strings -DTCL_TK -DNO_VOID -DNDEBUG -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_13 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCLINT_H -DHAVE_TCL_H -I. -I/home/bibudhendu/Desktop/ns2/tclcl-1.19 -I/home/bibudhendu/Desktop/ns2/otcl-1.13 -I/usr/local/include -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic tkUnixInit.c

rm -f xwd.o; gcc -o xwd.o -c -Wall -Wno-write-strings -DTCL_TK -DNO_VOID -DNDEBUG -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_13 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCLINT_H -DHAVE_TCL_H -I. -I/home/bibudhendu/Desktop/ns2/tclcl-1.19 -I/home/bibudhendu/Desktop/ns2/otcl-1.13 -I/usr/local/include -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic -I/home/bibudhendu/Desktop/ns2/tcl8.4.19/generic xwd.c

xwd.c:87:29: error: X11/Xmu/WinUtil.h: No such file or directory make: *** [xwd.o] Error 1

Solution:
Install the package libxmu-dev. Then run

./configure
make clean
make
sudo make install

5. Problem while running 'make' for xgraph

/usr/include/stdio.h:651: note: expected ‘size_t * __restrict__’ but argument is of type ‘char *’
dialog.c:780: error: too few arguments to function ‘getline’
dialog.c: In function ‘getline’:
dialog.c:899: error: argument ‘lptr’ doesn’t match prototype
/usr/include/stdio.h:651: error: prototype declaration
dialog.c:899: error: number of arguments doesn’t match prototype
/usr/include/stdio.h:651: error: prototype declaration
make: *** [dialog.o] Error 1

Solution:

Download the patch below-

http://archive.ubuntu.com/ubuntu/pool/universe/x/xgraph/xgraph_12.1-12.diff.gz

Note: copy and unzip the above patch file into xgraph-12.1
view source
print?
1 patch < xgraph_12.1-12.diff
After applying the patch if you see in get any problem with the configure.in file like

configure.in:3: version mismatch. This is Automake 1.11,
configure.in:3: but the definition used by this AM_INIT_AUTOMAKE
configure.in:3: comes from Automake 1.11.1. You should recreate
configure.in:3: aclocal.m4 with aclocal and run automake again.

then goto configure.in file and add 'AC_LOCAL' in the first line.

No comments:

Post a Comment