Building ns-2 on Cygwin [versions 2.27, 2.26 and 2.1b9a(*)]

This is the pre-ns-2.28 ns-cgwin page from Nicolas Christin, previously abailable at

Here are relatively simple instructions to get the ns-2 network simulator package to fully build on Cygwin for Microsoft Windows 9x/ME/NT/2000/XP. The major differences with the native Win32 build are that (1) you can build allinone, without the need for downloading separate components, (2) the build process doesn't require VisualStudio to compile any component, (3) nam won't run as a standalone Windows application, but within the Cygwin XFree86 server, (4) unless you are using an older version of Cygwin, validation tests should work, and (5), as of ns-2.26, the native Win32 build is not actively maintained anymore, so that you have to use Cygwin. You are strongly advised to read the entire set of following instructions first, before proceeding with the actual install.

Please do not email me privately about this webpage, ns-2, Cygwin, or XFree86, except for pointing out mistakes or typos in this web page. If you have questions, post them on the ns-users mailing-list instead, out of fairness for other users. See Russ Allbery's excellent page for a complete list of reasons why I will not reply to private emails.

(*)Important remark: due to a few syntactic glitches, ns-allinone-2.1b9a does not compile anymore with recent (>= 3.3) versions of gcc. We have no plans in backporting to 2.1b9a the (trivial) patch which fixes those glitches. You should upgrade to 2.27. If that is not feasible, look at the patch ns-allinone-2.26-cygwin.patch for inspiration on how to fix the few compilation problems, or use gcc-3.2. (*) For installs of older versions (including 2.1b9a without the gcc-3.2 patches), you will first have to get ns-2 to compile with gcc-3.2. A roadmap of the changes is available in the ns-users mailing-list archives (search them!) at,,, and, and for nam. (Entire discussion and ideas courtesy of George Riley, Igor Sobrado, Jun He, Piyush Kenghar, and myself.)
Thomas Knoll has actually prepared a summary of these posts, and instructions on how to patch ns-allinone-2.1b6a, as well as a patched tree for gcc-3.2 of ns-allinone-2.1b6a. He has made all of this available in this page. Presumably, you only need to go through the Cygwin specific modifications detailed above to get 2.1b6a to compile in Cygwin, but I haven't tried it. Last modified: