SlideShare a Scribd company logo
Direction of building NS2 platform using Cygwin under Windows OS
Huang Xuguang 22082228
xuguangmit@gmail.com
1. Introduction
This document aims to give the direction of building NS2 using Cygwin under windows os.
The procedures and common errors are listed in this document.
The software and source codes we need are:
 Cygwin:
Downloaded from http://www.cygwin.com
 NS2 source code:
Downloaded from http://www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz
version: ns-allinone-2.27.tar.gz
 Patch of NS2:
Downloaded from http://www.ececs.uc.edu/~cdmc/ucbt/src/ns227-gcc34.patch
 Patch of tk:
Downloaded from http://bugs.gentoo.org/show_bug.cgi?id=225999
version: tk-8.4.18-tkbind.patch
 LEACH source code:
Downloaded http://www.internetworkflow.com/downloads/ns2leach/mit.tar.gz
2. Steps
1> Install Cygwin
It is easy to install Cygwin under windows os.
a. First, get the software from http://www.cygwin.com.
b. Launch setup.
c. Here you must install these packages because NS2 needs them:
XFree86-base, XFree86-bin, XFree86-prog, XFree86-lib, XFree86-etc, make, patch,
perl, gcc, gcc-g++, gawk, gnuplot, tar and gzip
d. After finishing the setup, you can start Cygwin and the screen should be like this:
Then checking the root of Cygwin, making sure there are one folder named “home”
and there are three hidden files in “home/{username}” which
are .bashrc, .bashrc_profile and .inputrc.
2> Install NS2
a. Unzip the source code of NS2 and it includes these files:
Command: tar xvfz ns-allinone-2.27.tar.gz
b. Install patch.
Before we excuse the compilation process, we’d better to install patch of NS2 to
avoid mistakes.
 Download the patch named ns227-gcc34.patch and put it in the same dir with
ns-allinone-2.27.
 Install it.
Command: patch -p0 <ns227-gcc34.patch
c. Enter the dir of ns2 and install it.
Command:
cd ns-allinone-2.27
./install
ERROR
no ‘home’ folder and no three hidden files
SOLVATION
Check the Environment Variable of your computer; delete the entry which named ‘HOME’
 TCL release 8.4.5 (required component)
 TK release 8.4.5 (required component)
 Otcl release 1.8 (required component)
 TclCL release 1.15 (required component)
 Ns release 2.27 (required component)
 Nam release 1.10 (optional component)
 Xgraph version 12.1 (optional component)
 CWeb (optional component)
 SGB (optional component, builds sgblib for all UNIX type platforms)
 Gt-itm (optional component)
 Zlib version 1.1.4 (optional, but required when Nam is used)
d. Finish compiling.
Generally, the compilation process will cost about 4 hours (depended on your
computer). If you finish this step successfully, you will see this:
During this step, you would meet many problems. I list the common errors I met and
give the salvations.
e. Setting environment variables.
Edit the file “.bashrc” which is a hidden file in your “home/{username}” folder and
insert these sentences:
f. Test NS2.
Now, you have finished installing NS2. You can use an example to test NS2.
 Start xwindow
Command: startxwin.bat
export NS_HOME=`pwd`/ns-allinone-2.27
export PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/bin:$PATH
export
LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/otcl-1.8:$N
S_HOME/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library
ERROR
Tcl is not part of the ns project
SOLVATION
Modify the following files, find the words “.relid'`” and use “.relid`” instead.
ns-allinone-2.28tcl8.4.5unixconfigure
ns-allinone-2.28tcl8.4.5unixtcl.m4
ns-allinone-2.28tk8.4.5unixconfigure
ns-allinone-2.28tk8.4.5unixtcl.m4
ns-allinone-2.28otcl-1.8configure
 Launch the example
Command:
cd ns-allinone-2.27/ns-2.27/ns-tutorial/examples
ns example2.tcl
 Executing the example and you would see:
ERROR
nam: no such file or directory
SOLVATION
There are two methods:
1. Check the folder “ns-allinone-2.28/nam-1.11”, copy nam.exe to “ns-allinone-2.28/bin” if it exists.
2. Recompile the nam if there is no “nam.exe” in this catalog “ns-allinone-2.28/nam-1.11”.
 Edit the file agent.h under “nam-1.11/agent.h”
 Change “NULL” to “0” in line 73.
 Run ./configure; make
Congratulations if you can see these two windows! You have installed NS2 sucessfully.
3> Loading LEACH
a. Dowload LEACH source code and put it under “ns-allinone-2.27/ns-2.27”.
Unzip the package.
Command:
gunzip mit.tar.gz
tar -xvf mit.tar
b. Modify “makefile” file.
 Find the paragraph beginning with “DEFINE”, add
-DMIT_uAMPS
in its end.
 Find the paragraph beginning with “INCLUDES”, add one line
-I./mit/rca –I./mit/uAMPS
in its end.
 Find the line “gaf/gaf.o ”, add these before it.
mit/rca/energy.o mit/rca/rcagent.o 
mit/rca/rca-ll.o mit/rca/resource.o 
mac/mac-sensor-timers.o mac/mac-sensor.o mit/uAMPS/bsagent.o 
The file should be like this:
c. Set environment variable
 Edit the file “.bashrc” which is under the catalog “home/{username}”. Add
export RCA_LIBRARY={$NS_HOME}/ns-allinone-2.27/ns-2.27/mit/rca
export uAMPS_LIBRARY={$NS_HOME}/ns-allinone-2.27/ns-2.27/mit/uAMPS
 Edit wireless-phy.cc which is under “ns-allinone-2.27/ns-2.27/mac”, add the
definition
#define min(a,b) (((a)>(b))?(b):(a))
behind the sentence “#define max(a,b) (((a)<(b))?(b):(a))”
d. Compile the LEACH
Command:
make clean
make
To compile the LEACH would cost about 10 to 30 minutes (depend on your
computer). After this step, you can run an example to test LEACH.
Command:
./test
LEACH is successfully installed if you see this:
e. Check the leach.err file under “ns-allinone-2.27ns-2.27mitleach_sims”, the
content would be this if LEACH works well.
ERROR
line3: ns:command not found
SOLVATION
1. Modify “./test” file, put the line “./leach_test” under the line “cd ../../”. It looks like this:
sleep 2
cd ../../
./leach_test
2. Modify “./leach_test” file, add
RCA_LIBRARY=mit/rca
export RCA_LIBRARY
uAMPS_LIBRARY=mit/uAMPS
export uAMPS_LIBRARY
before the line “ns tcl/ex/wireless.tcl ”

More Related Content

PPT
Tutorial1 Cygwin
PPT
Ns-2.35 Installation
KEY
20111126 ns2 installation
PPT
20111107 ns2-required cygwinpkg
PPTX
Python+anaconda Development Environment
PDF
Installation instructions for R
KEY
Shibuya,trac セッション
PPTX
Solidity intro
Tutorial1 Cygwin
Ns-2.35 Installation
20111126 ns2 installation
20111107 ns2-required cygwinpkg
Python+anaconda Development Environment
Installation instructions for R
Shibuya,trac セッション
Solidity intro

What's hot (20)

PPTX
How do I run the Crawford Slackware Box?
ODP
ClusterDesktop manual how-to use for windows clients
PPTX
Node js packages [#howto with npm]
DOCX
Boot-To-Root KIOPTRIX Level -1
PDF
Vagrant勉強会 チュートリアル編
PDF
Rails Plugins 2 Hoe
ODP
ClusterDesktop how-to use on Mac
PDF
ovs-2.3.1 on debian 8.1
PPTX
DrupalCafe Vol.35 - Dockerで始めるDrupal
PPTX
Groovy for System Administrators
PPTX
Capistrano与jenkins(hudson)在java web项目中的实践
ODP
Nodejs Intro - Part2 Introduction to Web Applications
PPT
Nodejs Intro Part One
PPTX
Ruby on Windows - HOW TO install and set up
PDF
Vagrant plugin development intro
PDF
Introduction to Docker
PDF
Installing Python on Mac
PDF
Inspectrum vs the doorbell
PDF
Aleksandr Matrosov, Eugene Rodionov - Win32 Duqu - involution of Stuxnet
PDF
using Virtualbox NAT and shared folder
How do I run the Crawford Slackware Box?
ClusterDesktop manual how-to use for windows clients
Node js packages [#howto with npm]
Boot-To-Root KIOPTRIX Level -1
Vagrant勉強会 チュートリアル編
Rails Plugins 2 Hoe
ClusterDesktop how-to use on Mac
ovs-2.3.1 on debian 8.1
DrupalCafe Vol.35 - Dockerで始めるDrupal
Groovy for System Administrators
Capistrano与jenkins(hudson)在java web项目中的实践
Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro Part One
Ruby on Windows - HOW TO install and set up
Vagrant plugin development intro
Introduction to Docker
Installing Python on Mac
Inspectrum vs the doorbell
Aleksandr Matrosov, Eugene Rodionov - Win32 Duqu - involution of Stuxnet
using Virtualbox NAT and shared folder
Ad

Viewers also liked (20)

PDF
NS-2 Manual
PDF
Cygwin ug-net
PPT
Ultimate Power Profits
PPTX
Piet Mondrian
PPTX
PPTX
Deconstruction of 3 music magazine covers
PPTX
Question 7
PDF
Correction md2 fabien orienté object
PPT
Beethoven r&m
PDF
Mission-Driven Interaction Design
PPT
Deconstruction od magazine front covers
PPTX
Evaluation Question 5
ODP
Athens Startup Weekend - pspace
PDF
Mothers day Motivation
PDF
Wifisky wireless adapter(ralink 3070)
PDF
PT TOSANDA DWI SAPURWA
PDF
Designing The Listening Experience: The Making of NPR One
PPTX
Adjetives by David Hernandez
NS-2 Manual
Cygwin ug-net
Ultimate Power Profits
Piet Mondrian
Deconstruction of 3 music magazine covers
Question 7
Correction md2 fabien orienté object
Beethoven r&m
Mission-Driven Interaction Design
Deconstruction od magazine front covers
Evaluation Question 5
Athens Startup Weekend - pspace
Mothers day Motivation
Wifisky wireless adapter(ralink 3070)
PT TOSANDA DWI SAPURWA
Designing The Listening Experience: The Making of NPR One
Adjetives by David Hernandez
Ad

Similar to Direction of building ns2 using cygwin under windows system (20)

PDF
NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.
PDF
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
PPTX
HPC_MPI_CICD.pptx
PDF
Oracle11g on fedora14
PDF
Oracle11g On Fedora14
PDF
Ns2leach
PDF
An introduction to_ns_nam_and_o_tcl_scripting
PPT
Unix Administration 2
PDF
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
PPTX
Project 2 - how to compile os161?
PDF
NIH package manager for pkgsrc
PDF
Install guide
PDF
Install guide
KEY
20111126 ns2installation-111125123338-phpapp02
PDF
Installation of lammps-5Nov14 on Mac OS X Yosemite
DOCX
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
PPT
TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...
PDF
1 session installation
RTF
Readme
NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
HPC_MPI_CICD.pptx
Oracle11g on fedora14
Oracle11g On Fedora14
Ns2leach
An introduction to_ns_nam_and_o_tcl_scripting
Unix Administration 2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Project 2 - how to compile os161?
NIH package manager for pkgsrc
Install guide
Install guide
20111126 ns2installation-111125123338-phpapp02
Installation of lammps-5Nov14 on Mac OS X Yosemite
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...
1 session installation
Readme

Direction of building ns2 using cygwin under windows system

  • 1. Direction of building NS2 platform using Cygwin under Windows OS Huang Xuguang 22082228 xuguangmit@gmail.com 1. Introduction This document aims to give the direction of building NS2 using Cygwin under windows os. The procedures and common errors are listed in this document. The software and source codes we need are:  Cygwin: Downloaded from http://www.cygwin.com  NS2 source code: Downloaded from http://www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz version: ns-allinone-2.27.tar.gz  Patch of NS2: Downloaded from http://www.ececs.uc.edu/~cdmc/ucbt/src/ns227-gcc34.patch  Patch of tk: Downloaded from http://bugs.gentoo.org/show_bug.cgi?id=225999 version: tk-8.4.18-tkbind.patch  LEACH source code: Downloaded http://www.internetworkflow.com/downloads/ns2leach/mit.tar.gz 2. Steps 1> Install Cygwin It is easy to install Cygwin under windows os. a. First, get the software from http://www.cygwin.com. b. Launch setup.
  • 2. c. Here you must install these packages because NS2 needs them: XFree86-base, XFree86-bin, XFree86-prog, XFree86-lib, XFree86-etc, make, patch, perl, gcc, gcc-g++, gawk, gnuplot, tar and gzip d. After finishing the setup, you can start Cygwin and the screen should be like this:
  • 3. Then checking the root of Cygwin, making sure there are one folder named “home” and there are three hidden files in “home/{username}” which are .bashrc, .bashrc_profile and .inputrc. 2> Install NS2 a. Unzip the source code of NS2 and it includes these files: Command: tar xvfz ns-allinone-2.27.tar.gz b. Install patch. Before we excuse the compilation process, we’d better to install patch of NS2 to avoid mistakes.  Download the patch named ns227-gcc34.patch and put it in the same dir with ns-allinone-2.27.  Install it. Command: patch -p0 <ns227-gcc34.patch c. Enter the dir of ns2 and install it. Command: cd ns-allinone-2.27 ./install ERROR no ‘home’ folder and no three hidden files SOLVATION Check the Environment Variable of your computer; delete the entry which named ‘HOME’  TCL release 8.4.5 (required component)  TK release 8.4.5 (required component)  Otcl release 1.8 (required component)  TclCL release 1.15 (required component)  Ns release 2.27 (required component)  Nam release 1.10 (optional component)  Xgraph version 12.1 (optional component)  CWeb (optional component)  SGB (optional component, builds sgblib for all UNIX type platforms)  Gt-itm (optional component)  Zlib version 1.1.4 (optional, but required when Nam is used)
  • 4. d. Finish compiling. Generally, the compilation process will cost about 4 hours (depended on your computer). If you finish this step successfully, you will see this: During this step, you would meet many problems. I list the common errors I met and give the salvations. e. Setting environment variables. Edit the file “.bashrc” which is a hidden file in your “home/{username}” folder and insert these sentences: f. Test NS2. Now, you have finished installing NS2. You can use an example to test NS2.  Start xwindow Command: startxwin.bat export NS_HOME=`pwd`/ns-allinone-2.27 export PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/bin:$PATH export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/otcl-1.8:$N S_HOME/lib:$LD_LIBRARY_PATH export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library ERROR Tcl is not part of the ns project SOLVATION Modify the following files, find the words “.relid'`” and use “.relid`” instead. ns-allinone-2.28tcl8.4.5unixconfigure ns-allinone-2.28tcl8.4.5unixtcl.m4 ns-allinone-2.28tk8.4.5unixconfigure ns-allinone-2.28tk8.4.5unixtcl.m4 ns-allinone-2.28otcl-1.8configure
  • 5.  Launch the example Command: cd ns-allinone-2.27/ns-2.27/ns-tutorial/examples ns example2.tcl  Executing the example and you would see: ERROR nam: no such file or directory SOLVATION There are two methods: 1. Check the folder “ns-allinone-2.28/nam-1.11”, copy nam.exe to “ns-allinone-2.28/bin” if it exists. 2. Recompile the nam if there is no “nam.exe” in this catalog “ns-allinone-2.28/nam-1.11”.  Edit the file agent.h under “nam-1.11/agent.h”  Change “NULL” to “0” in line 73.  Run ./configure; make
  • 6. Congratulations if you can see these two windows! You have installed NS2 sucessfully. 3> Loading LEACH a. Dowload LEACH source code and put it under “ns-allinone-2.27/ns-2.27”. Unzip the package. Command: gunzip mit.tar.gz tar -xvf mit.tar b. Modify “makefile” file.  Find the paragraph beginning with “DEFINE”, add -DMIT_uAMPS in its end.  Find the paragraph beginning with “INCLUDES”, add one line -I./mit/rca –I./mit/uAMPS in its end.  Find the line “gaf/gaf.o ”, add these before it. mit/rca/energy.o mit/rca/rcagent.o mit/rca/rca-ll.o mit/rca/resource.o mac/mac-sensor-timers.o mac/mac-sensor.o mit/uAMPS/bsagent.o The file should be like this: c. Set environment variable  Edit the file “.bashrc” which is under the catalog “home/{username}”. Add export RCA_LIBRARY={$NS_HOME}/ns-allinone-2.27/ns-2.27/mit/rca export uAMPS_LIBRARY={$NS_HOME}/ns-allinone-2.27/ns-2.27/mit/uAMPS  Edit wireless-phy.cc which is under “ns-allinone-2.27/ns-2.27/mac”, add the definition #define min(a,b) (((a)>(b))?(b):(a)) behind the sentence “#define max(a,b) (((a)<(b))?(b):(a))” d. Compile the LEACH Command: make clean make To compile the LEACH would cost about 10 to 30 minutes (depend on your computer). After this step, you can run an example to test LEACH. Command: ./test
  • 7. LEACH is successfully installed if you see this: e. Check the leach.err file under “ns-allinone-2.27ns-2.27mitleach_sims”, the content would be this if LEACH works well. ERROR line3: ns:command not found SOLVATION 1. Modify “./test” file, put the line “./leach_test” under the line “cd ../../”. It looks like this: sleep 2 cd ../../ ./leach_test 2. Modify “./leach_test” file, add RCA_LIBRARY=mit/rca export RCA_LIBRARY uAMPS_LIBRARY=mit/uAMPS export uAMPS_LIBRARY before the line “ns tcl/ex/wireless.tcl ”