How to install ns-2
Windows(Cygwin 2.1.0-1)
Last update: 2015-07-30
Since ns-allinone is old, we can no longer install it as is.
So, in order to install ns-2 on a windows environment, we have to
proceed the following steps.
-
Install Cygwin32 in your windows environment.
ns-2 cannot be compiled by 64bit system.
-
Obtain ns-allinone-2.35.tar.gz.
Make a working directory at your Cygwin environment.
Extract the files of ns-allinone-2.35 by using tar zxf
command.
-
We can no longer compile old tcl attached to ns-allinone on Cygwin 2.1.0-1.
So remove both tcl and tk folders from ns-allinone directory.
-
The following packages of Cygwin are required to compile ns-allinone:
- gcc-core
- gcc-g++
- make
- patch
- perl
- w32api-header
- w32api-runtime
- xorg-server
- xinit
- libx11-devel
- libxmu-devel
- tcl
- tcl-devel
- tcl-tk
- tcl-tk-devel
Install these packages into the Cygwin environment by using
setup-x86.exe.
-
One of the header file of TCL has a problem.
Then, revise the header file tclPort.h by applying the following patch file:
--- /usr/include/tcl8.5/generic/tclPort.h.orig 2015-07-16 16:05:12.847300600 +0900
+++ /usr/include/tcl8.5/generic/tclPort.h 2015-07-13 04:32:03.545287700 +0900
@@ -20,7 +20,7 @@
#if defined(_WIN32)
# include "tclWinPort.h"
#else
-# include "tclUnixPort.h"
+# include "../unix/tclUnixPort.h"
#endif
#include "tcl.h"
This revise must be applied by using a text editor manually.
Otherwise, once
one tried to apply this patch by using patch command, the patch
command would not change the file with only reporting that the file is
dangerous.
-
In order to changing the name of libraries, make symbolic links by
the following commands:
ln -s /usr/lib/libtcl.dll.a /usr/lib/libtcl.a
ln -s /usr/lib/libtk.dll.a /usr/lib/libtk.a
-
Apply this patch file.
First, put the patch file, pfile.txt, at the same directory where
ns-allinone-2.35 directory is located.
Second, move the current directory to the directory where pfile.txt exists.
Finally, apply the following command:
patch -p0 < pfile.txt
-
Move the current directory to ns-allinone-2.35.
Then, do ./install
- Type the following command, so that the results of finding dll files
are saved into a file(say rebaselist).
find . -iname '*.dll' > rebaselist
Assume that the directory where the above command is proceeded
is /home/username/ns-allinone-2.35.
That is, the full path of the file is assumed to be /home/username/ns-allinone-2.35/rabeselist.
- Then, do rebaseall by the following steps:
- Terminate any Cygwin terminals.
- Start cmd.exe
- Move current directory to ${CYGWINDIR}\bin by using CD
command as following:
cd \cygwin\bin
- Start dash by applying the following command:
.\dash
- Move the current directory to the directory where the rebase
list file is placed:
cd /home/usrname/ns-allinone-2.35
- Do rebaseall by the following command:
/bin/rebaseall -T rebaselist -v
- Type exit, then you exit dash.
- Finally, now ns-2.35 is available! However, in order to pass the
path, ns-allinone-2.35/bin, add the following line to
.bash_profile
PATH="${HOME}/ns-allinone-2.35/bin:${PATH}"
Note that validate fails at test-all-tcpLinux and test-all-simulteneous.
Usage
If you would like to use nam, then proceed the following commands in
advance:
startxwin &
export DISPLAY=:0.0
This may cause Windows to ask you to permit to access some network
port.
If you are asked, then allow it.
Appendix
a bash script for making the patch file mkpatch.bash
Naoshi SAKAMOTO <sakamoto@c.dendai.ac.jp>
Department of Information and Communication Engineering,
School of Engineering,
Tokyo Denki University.