SlideShare une entreprise Scribd logo
1  sur  7
Télécharger pour lire hors ligne
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 ”

Contenu connexe

Tendances

How do I run the Crawford Slackware Box?
How do I run the Crawford Slackware Box? How do I run the Crawford Slackware Box?
How do I run the Crawford Slackware Box? Paul Prawdzik
 
ClusterDesktop manual how-to use for windows clients
ClusterDesktop manual how-to use for windows clientsClusterDesktop manual how-to use for windows clients
ClusterDesktop manual how-to use for windows clientsEmil Parashkevov
 
Node js packages [#howto with npm]
Node js packages [#howto with npm]Node js packages [#howto with npm]
Node js packages [#howto with npm]Andrii Lundiak
 
Boot-To-Root KIOPTRIX Level -1
Boot-To-Root KIOPTRIX Level -1Boot-To-Root KIOPTRIX Level -1
Boot-To-Root KIOPTRIX Level -1Venkat Raman
 
Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編Vagrant勉強会 チュートリアル編
Vagrant勉強会 チュートリアル編Yasuyuki Sugai
 
Rails Plugins 2 Hoe
Rails Plugins 2 HoeRails Plugins 2 Hoe
Rails Plugins 2 Hoeoscon2007
 
ClusterDesktop how-to use on Mac
ClusterDesktop how-to use on MacClusterDesktop how-to use on Mac
ClusterDesktop how-to use on MacEmil Parashkevov
 
ovs-2.3.1 on debian 8.1
ovs-2.3.1 on debian 8.1ovs-2.3.1 on debian 8.1
ovs-2.3.1 on debian 8.1Clive Peng
 
DrupalCafe Vol.35 - Dockerで始めるDrupal
DrupalCafe Vol.35 - Dockerで始めるDrupalDrupalCafe Vol.35 - Dockerで始めるDrupal
DrupalCafe Vol.35 - Dockerで始めるDrupalYoshikazu Aoyama
 
Groovy for System Administrators
Groovy for System AdministratorsGroovy for System Administrators
Groovy for System AdministratorsDaniel Woods
 
Capistrano与jenkins(hudson)在java web项目中的实践
Capistrano与jenkins(hudson)在java web项目中的实践Capistrano与jenkins(hudson)在java web项目中的实践
Capistrano与jenkins(hudson)在java web项目中的实践crazycode t
 
Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web ApplicationsNodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web ApplicationsBudh Ram Gurung
 
Ruby on Windows - HOW TO install and set up
Ruby on Windows - HOW TO install and set upRuby on Windows - HOW TO install and set up
Ruby on Windows - HOW TO install and set upTim Golden
 
Vagrant plugin development intro
Vagrant plugin development introVagrant plugin development intro
Vagrant plugin development introBudh Ram Gurung
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerEmil Stenqvist
 
Installing Python on Mac
Installing Python on MacInstalling Python on Mac
Installing Python on MacWei-Wen Hsu
 
Inspectrum vs the doorbell
Inspectrum vs the doorbellInspectrum vs the doorbell
Inspectrum vs the doorbellPamela O'Shea
 
Aleksandr Matrosov, Eugene Rodionov - Win32 Duqu - involution of Stuxnet
Aleksandr Matrosov, Eugene Rodionov - Win32 Duqu - involution of StuxnetAleksandr Matrosov, Eugene Rodionov - Win32 Duqu - involution of Stuxnet
Aleksandr Matrosov, Eugene Rodionov - Win32 Duqu - involution of StuxnetDefconRussia
 
using Virtualbox NAT and shared folder
using Virtualbox NAT and shared folderusing Virtualbox NAT and shared folder
using Virtualbox NAT and shared folderYingshiuan Pan
 

Tendances (20)

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

En vedette

NS-2 Manual
NS-2 ManualNS-2 Manual
NS-2 Manualcode453
 
Ultimate Power Profits
Ultimate Power ProfitsUltimate Power Profits
Ultimate Power ProfitsPaul Morris
 
Deconstruction of 3 music magazine covers
Deconstruction of 3 music magazine covers Deconstruction of 3 music magazine covers
Deconstruction of 3 music magazine covers rachelblack10
 
Correction md2 fabien orienté object
Correction md2 fabien orienté objectCorrection md2 fabien orienté object
Correction md2 fabien orienté objectyahyaoui hamdi
 
Beethoven r&m
Beethoven r&mBeethoven r&m
Beethoven r&mnakki123
 
Mission-Driven Interaction Design
Mission-Driven Interaction DesignMission-Driven Interaction Design
Mission-Driven Interaction DesignDaniel Newman
 
Deconstruction od magazine front covers
Deconstruction od magazine front coversDeconstruction od magazine front covers
Deconstruction od magazine front coversNiamh1996
 
Evaluation Question 5
Evaluation Question 5Evaluation Question 5
Evaluation Question 5rachelblack10
 
Athens Startup Weekend - pspace
Athens Startup Weekend - pspaceAthens Startup Weekend - pspace
Athens Startup Weekend - pspaceTasos Sagiotis
 
Wifisky wireless adapter(ralink 3070)
Wifisky wireless adapter(ralink 3070)Wifisky wireless adapter(ralink 3070)
Wifisky wireless adapter(ralink 3070)sabrishafie
 
Designing The Listening Experience: The Making of NPR One
Designing The Listening Experience: The Making of NPR OneDesigning The Listening Experience: The Making of NPR One
Designing The Listening Experience: The Making of NPR OneDaniel Newman
 
Adjetives by David Hernandez
Adjetives by David HernandezAdjetives by David Hernandez
Adjetives by David Hernandezdvd_h
 

En vedette (20)

NS-2 Manual
NS-2 ManualNS-2 Manual
NS-2 Manual
 
Cygwin ug-net
Cygwin ug-netCygwin ug-net
Cygwin ug-net
 
Ultimate Power Profits
Ultimate Power ProfitsUltimate Power Profits
Ultimate Power Profits
 
Piet Mondrian
Piet MondrianPiet Mondrian
Piet Mondrian
 
SocEat
SocEatSocEat
SocEat
 
K2
K2K2
K2
 
Deconstruction of 3 music magazine covers
Deconstruction of 3 music magazine covers Deconstruction of 3 music magazine covers
Deconstruction of 3 music magazine covers
 
K3
K3K3
K3
 
Question 7
Question 7 Question 7
Question 7
 
Correction md2 fabien orienté object
Correction md2 fabien orienté objectCorrection md2 fabien orienté object
Correction md2 fabien orienté object
 
Beethoven r&m
Beethoven r&mBeethoven r&m
Beethoven r&m
 
Mission-Driven Interaction Design
Mission-Driven Interaction DesignMission-Driven Interaction Design
Mission-Driven Interaction Design
 
Deconstruction od magazine front covers
Deconstruction od magazine front coversDeconstruction od magazine front covers
Deconstruction od magazine front covers
 
Evaluation Question 5
Evaluation Question 5Evaluation Question 5
Evaluation Question 5
 
Athens Startup Weekend - pspace
Athens Startup Weekend - pspaceAthens Startup Weekend - pspace
Athens Startup Weekend - pspace
 
Mothers day Motivation
Mothers day MotivationMothers day Motivation
Mothers day Motivation
 
Wifisky wireless adapter(ralink 3070)
Wifisky wireless adapter(ralink 3070)Wifisky wireless adapter(ralink 3070)
Wifisky wireless adapter(ralink 3070)
 
PT TOSANDA DWI SAPURWA
PT TOSANDA DWI SAPURWAPT TOSANDA DWI SAPURWA
PT TOSANDA DWI SAPURWA
 
Designing The Listening Experience: The Making of NPR One
Designing The Listening Experience: The Making of NPR OneDesigning The Listening Experience: The Making of NPR One
Designing The Listening Experience: The Making of NPR One
 
Adjetives by David Hernandez
Adjetives by David HernandezAdjetives by David Hernandez
Adjetives by David Hernandez
 

Similaire à Direction of building ns2 using cygwin under windows system

Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios CoreNrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios CoreNagios
 
NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.
NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.
NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.Marc Trimble
 
Oracle11g On Fedora14
Oracle11g On Fedora14Oracle11g On Fedora14
Oracle11g On Fedora14kmsa
 
An introduction to_ns_nam_and_o_tcl_scripting
An introduction to_ns_nam_and_o_tcl_scriptingAn introduction to_ns_nam_and_o_tcl_scripting
An introduction to_ns_nam_and_o_tcl_scriptingDani Aristiyawan
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2 Adil Khan
 
Project 2 - how to compile os161?
Project 2 - how to compile os161?Project 2 - how to compile os161?
Project 2 - how to compile os161?Xiao Qin
 
20111126 ns2installation-111125123338-phpapp02
20111126 ns2installation-111125123338-phpapp0220111126 ns2installation-111125123338-phpapp02
20111126 ns2installation-111125123338-phpapp02suwittosan
 
Installation of lammps-5Nov14 on Mac OS X Yosemite
Installation of lammps-5Nov14 on Mac OS X YosemiteInstallation of lammps-5Nov14 on Mac OS X Yosemite
Installation of lammps-5Nov14 on Mac OS X Yosemitefirst name chibaf
 
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxPart 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxkarlhennesey
 
TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...
TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...
TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...Concentrated Technology
 
1 session installation
1 session installation1 session installation
1 session installationRahul Hada
 

Similaire à Direction of building ns2 using cygwin under windows system (20)

Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios CoreNrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
 
NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.
NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.
NRPE - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core 4 and others.
 
HPC_MPI_CICD.pptx
HPC_MPI_CICD.pptxHPC_MPI_CICD.pptx
HPC_MPI_CICD.pptx
 
Oracle11g On Fedora14
Oracle11g On Fedora14Oracle11g On Fedora14
Oracle11g On Fedora14
 
Oracle11g on fedora14
Oracle11g on fedora14Oracle11g on fedora14
Oracle11g on fedora14
 
Ns2leach
Ns2leachNs2leach
Ns2leach
 
An introduction to_ns_nam_and_o_tcl_scripting
An introduction to_ns_nam_and_o_tcl_scriptingAn introduction to_ns_nam_and_o_tcl_scripting
An introduction to_ns_nam_and_o_tcl_scripting
 
Nrpe
NrpeNrpe
Nrpe
 
Unix Administration 2
Unix Administration 2Unix Administration 2
Unix Administration 2
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 
Project 2 - how to compile os161?
Project 2 - how to compile os161?Project 2 - how to compile os161?
Project 2 - how to compile os161?
 
NIH package manager for pkgsrc
NIH package manager for pkgsrcNIH package manager for pkgsrc
NIH package manager for pkgsrc
 
Install guide
Install guideInstall guide
Install guide
 
Install guide
Install guideInstall guide
Install guide
 
20111126 ns2installation-111125123338-phpapp02
20111126 ns2installation-111125123338-phpapp0220111126 ns2installation-111125123338-phpapp02
20111126 ns2installation-111125123338-phpapp02
 
Installation of lammps-5Nov14 on Mac OS X Yosemite
Installation of lammps-5Nov14 on Mac OS X YosemiteInstallation of lammps-5Nov14 on Mac OS X Yosemite
Installation of lammps-5Nov14 on Mac OS X Yosemite
 
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxPart 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
 
TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...
TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...
TechMentor Fall, 2011 - Packaging Software for Automated Deployment with Wind...
 
1 session installation
1 session installation1 session installation
1 session installation
 
Readme
ReadmeReadme
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 ”