Running Ns and Nam Under Windows 9x/2000/XP Using Cygwin
Since version 2.1b9, ns has been tested to build and validate under Windows 9x/2000/XP using Cygwin. Cygwin provides a Linux-like environment under Windows. The ns-allinone for the current version (2.34) builds straight out-of-the-box, although a few validation tests may fail.
Important: the primary ns build platform are various flavors of Unix, so build and validation problems on Windows are more frequent. Patches from Windows users to correct any problems are always welcome (Post them to ns-users).
Windows Support Before Ns-2.28
Ns versions up to 2.1b9 work under Windows using Visual C++. However, this method is not actively supported anymore in more recent versions. If you need to use such a version on Windows, you can still find the old instructions on the Windows / Visual C++ page. Since version 2.1b9, ns has used Cygwin/gcc instead of Visual C++. Instructions for running ns 2.1b9, 2.26, and 2.27 under Cygwin are available here. They have been formerly been posted on Nicolas Christin's web page.
What Is Different With the Cygwin Port in Comparison to the Native Port?
- You can build allinone, without the need for downloading separate components.
- The build process doesn't require Visual Studio to compile any component.
- Nam won't run as a standalone Windows application, but within the Cygwin X server.
- Unless you are using an older version of Cygwin, nearly all validation tests should work.
- As of ns-2.26, the native Win32 build is not actively maintained anymore.
Requirements and Installation Tips
You'll need:
- Windows 9x/2000/XP. The current test system is Windows XP SP2.
- Cygwin-1.3.12 or later. May work with older versions but it's not tried. The current test system uses version 1.5.12.
When installing Cygwin with thesetup.exe
program, you'll have to consider some points:
- Make sure you have installed Cygwin with the UNIX text type. (It's the default during the Cygwin install procedure.) Using the DOS text type hasn't been tested, but is likely to lead to a number of errors in the validation tests. It's pretty easy to check which text type you are using, just at the prompt, do a
mount | grep textmode
and if you don't get anything (i.e., it returns an empty string), you should be fine. If the above command does return something, you are quite likely using the DOS text type, and you may be in trouble. - Also, make sure your Cygwin installation directory does not contain any spaces. Spaces in the root directory seem to be causing a lot of problems. In particular,
C:/Cygwin
(the default) is a good installation directory,C:/Program Files/Cygwin
is not. - To avoid potential problems, make sure you don't have spaces in your login name. If you do, change your login name.
- You'll need X11. Depending on which version of Cygwin you'll use, this might be either Xfree86 (packages
XFree86-base
,XFree86-bin
,XFree86-prog
,XFree86-lib
, andXFree86-etc
) or X.org (packagesxorg-x11-bin
,xorg-x11-bin-dlls
,xorg-x11-devel
,xorg-x11-libs-data
, andxorg-x11-etc
).
If you are unfamiliar with X11, we recommend you take a look at the Cygwin/X User Guide, and the references therein. - Additionally, you'll need the following packages installed:
gcc
,gcc-g++
,gawk
,tar
,gzip
,make
,patch
,perl
, andw32api
. Any missing packages can be added with Cygwin'ssetup.exe
.
- Make sure you have installed Cygwin with the UNIX text type. (It's the default during the Cygwin install procedure.) Using the DOS text type hasn't been tested, but is likely to lead to a number of errors in the validation tests. It's pretty easy to check which text type you are using, just at the prompt, do a
- Ns-allinone, either source code or prebuilt binaries.
Building ns from pieces requires some tweaking of the included components, which has already been done for the allinone package. These instructions only cover ns-allinone.
After you've setup Cygwin, get ns-allinone-2.34.tar.gz
and unpack it to a directory reachable from Cygwin. Start the Cygwin Shell (bash
), cd
into your ns directory and issue
./install
at the command prompt. The installer will check if all prerequisites are met, and if so, will build the whole package.
The installation is similar to Unix install, so at the end of the build process you're advised to set some environment variables. This step is required for ns to work. You might want to add these variables to your ~/.bashrc
, so you don't have to retype them every time.
Finally, you might want to check your installation with
./validate
Note, that under version 2.34 a couple of regression tests don't pass using Cygwin. This is a known issue, and existed in ns-2.28 through ns-2.30 as well. See the ns problem page.
Using Pre-Built Binaries Under Cygwin
Prebuilt binaries for ns-allinone (version 2.28, released February 2005) to run under Cygwin are also available. It comes in a package that has all binaries and the required library files that the binaries depend on. Download the zipfile ns-allinone-2.28-cygwin-binaries.zip. Note, that you need to have Cygwin installed as described above. Especially, Cygwin has to be installed in C:/Cygwin!
Once you have cygwin and other required packages installed,
- Unzip the zipfile
ns-allinone-2.28-cygwin-binaries.zip
under your Cygwin root directory (C:/cygwin). It will place all binary files under/usr/bin
and libraries under/usr/lib
. - Next setup the path to the Tcl library by typing
export TCL_LIBRARY=/usr/lib/tcl8.4/
at the Cygwin (bash) shell prompt. - In order to run nam, you need to start the X server (type
startx
at the prompt) first and then runnam.exe
from one of the X terminals.
Note:You'll likely encounter the following message:
When configured, ns found the right version of tclsh in /home/dukat/ns-allinone-2.28/tcl8.4.5/unix/tclsh but it doesn't seem to be there anymore, so ns will fall back on running the first tclsh in your path. The wrong version of tclsh may break the test suites. Reconfigure and rebuild ns if this is a problem.
This is a cosmetical annoyance and doesn't hinder proper operation. To get rid of this message you'll have to compile ns from source.