The installation for Cygwin is somehow different - the key reason is that support for dynamic libraries in Windows is disappointing for a number of reasons. Consequently, the original version of the patch (i.e., the one referred to in the previous section) does not work with Cygwin.
So you have to download the cygwin version of the patch and perfom things slightly differently.
Put all the files in a directory of your choice, e.g., /home/signet/src, so that you end up in a situation like this:
signet@nbsignet ~/src $ ls -la total 69536 drwxr-xr-x 4 signet Nessuno 0 Oct 9 13:35 . drwxr-xr-x 4 signet Nessuno 0 Oct 5 16:54 .. -rw-r--r-- 1 signet Nessuno 27277 Aug 21 10:51 new-patch-dl-ns-2.31 -rw-r--r-- 1 signet Nessuno 70466306 Mar 11 2007 ns-allinone-2.31.tar.gz.gz
Unpack ns-allinone-2.31
:
signet@nbsignet ~/src $ tar xzf ns-allinone-2.31.tar.gz
Now apply the patch:
signet@nbsignet ~/src $ patch -p1 < new-patch-dl-ns-2.31 patching file ns-allinone-2.31/install patching file ns-allinone-2.31/ns-2.31/common/main.cc patching file ns-allinone-2.31/ns-2.31/common/packet.cc patching file ns-allinone-2.31/ns-2.31/common/packet.h patching file ns-allinone-2.31/ns-2.31/common/ptypes2tcl.cc patching file ns-allinone-2.31/ns-2.31/common/tclAppInit.cc patching file ns-allinone-2.31/ns-2.31/Makefile.in patching file ns-allinone-2.31/ns-2.31/tcl/lib/ns-default.tcl patching file ns-allinone-2.31/ns-2.31/tcl/lib/ns-lib.tcl patching file ns-allinone-2.31/ns-2.31/trace/cmu-trace.cc patching file ns-allinone-2.31/ns-2.31/trace/cmu-trace.h patching file ns-allinone-2.31/tcl8.4.14/unix/tcl.m4 patching file ns-allinone-2.31/tk8.4.14/unix/tcl.m4
The patch changes some m4 files in the tcl and tk packages, so you have to re-run autoconf both in the tcl8.4.14/unix
and tk8.4.14/unix
subdirectories:
signet@nbsignet ~/src $ cd ns-allinone-2.31/tcl8.4.14/unix signet@nbsignet ~/src/ns-allinone-2.31/tcl8.4.14/unix $ autoconf signet@nbsignet ~/src/ns-allinone-2.31/tcl8.4.14/unix $ cd ../../ signet@nbsignet ~/src/ns-allinone-2.31 $ cd tk8.4.14/unix signet@nbsignet ~/src/ns-allinone-2.31/tk8.4.14/unix $ autoconf signet@nbsignet ~/src/ns-allinone-2.31/tk8.4.14/unix $ cd ../../ signet@nbsignet ~/src/ns-allinone-2.31 $
Now you can build ns:
signet@nbsignet ~/src/ns-allinone-2.31 $ ./install
As usual, remember to set the LD_LIBRARY_PATH
and TCL_LIBRARY
environmental variables as told by the screen output of the installation process. It is also convenient to adjust the PATH
environmental variable so that the ns
executable can be found without specifying its location. A long story short, you need to add something like the following to your ~/.bashrc
file (remember to adjust all paths to your particular setup!):
export LD_LIBRARY_PATH=/home/signet/src/ns-allinone-2.31/otcl-1.13:/home/signet/src/ns-allinone-2.31/lib export TCL_LIBRARY=/home/signet/src/ns-allinone-2.31/tcl8.4.14/library export PATH=/home/signet/src/ns-allinone-2.31/bin:$PATH
As suggested for the linux installation, it is convenient to try to build a sample dynamic library module to check if the installation was successful. Download the dynamic library tcp-veno package
and put it in a directory of your choice, e.g., /home/signet/src
, unpack it and build it using the following procedure:
signet@nbsignet ~/src $ tar xzf tcp-veno-1.0.2.tar.gz signet@nbsignet ~/src $ cd tcp-veno-1.0.2 signet@nbsignet ~/src/tcp-veno-1.0.2 $ ./configure --with-ns-allinone=/home/signet/src/ns-allinone-2.31 signet@nbsignet ~/src/tcp-veno-1.0.2 $ make
If everything went ok, you'll end up with your freshly built dynamic library in the tcp-veno-1.0.2/src/.libs/
directory. One remarkable difference with respect to Linux: the file name of the library is different! In fact the name under linux is in the form libNAME.so
, whereas on cygwin it is in the form cygNAME-0.dll
1 as evident from this directory listing:
signet@nbsignet ~/src/tcp-veno-1.0.2 $ ls -l src/.libs/ total 1345 -rwxr-xr-x 1 signet Nessuno 859041 Oct 9 14:25 cygtcpveno-0.dll -rw-r--r-- 1 signet Nessuno 55654 Oct 9 14:25 libtcpveno.dll.a lrwxrwxrwx 1 signet Nessuno 16 Oct 9 14:25 libtcpveno.la -> ../libtcpveno.la -rw-r--r-- 1 signet Nessuno 825 Oct 9 14:25 libtcpveno.lai -rw-r--r-- 1 signet Nessuno 82553 Oct 9 14:25 libtcpveno_la-embeddedtcl.o -rw-r--r-- 1 signet Nessuno 312781 Oct 9 14:25 libtcpveno_la-tcp-veno.oJust keep the difference in library file names when loading libraries within your tcl script....
Anyway, back to our sample, if the library has been built correctly you should be able to run the provided sample tcl script:
signet@nbsignet ~/src/tcp-veno-1.0.2 $ cd samples/ signet@nbsignet ~/src/tcp-veno-1.0.2/samples $ ns test-veno.tcl Tracefile: /tmp/test-veno.tr TCP Veno log file: /tmp/veno.log