Minimum requirements
ns-3 is
primarily developed on GNU/Linux platforms.
-
GNU
Complier [ GNU Not Unix OS]
Minimal
requirements to run basic simulations are
§ Gcc: (GNU Complier Collection)
-
Latest
Release: GCC 5.3
-
Preprocessor
macros and functions
[fragment of code; valid identifier]
-
C,
C++, Fortran, Java, etc.
gcc.gnu.org
§ clang compiler:
-
C,
Objective C and C++ Complier
-
LLVM
[Low Level Virtual Machine]: ruby, R, python, C, etc. Back end
-
Stable
release: clang 3.7
clang.llvm.org
§ Python interpreter
-
High level programming language
[express in C++ or Java]
-
Dir:
/usr/local/bin/python
-
Developer:
python software foundation [Guido van
Rossum, the creator of Python]
-
Stable
release: python 3.5.1
www.python.org
ü gcc versions 4.2 - 4.8
ü clang version 3.3
Screen
Shot: To check whether the
above basic packages are installed.
In Windows platform,
ü Windows Visual Studio 2012
ü Windows Cygwin 1.7 Unix-like environment
and command-line interface for Microsoft Windows [https://cygwin.com/install.html]
ü Requirement: 100MB Size
Integrated Development Environment (IDE) support:
Eclipse:
The Eclipse IDE
NetBeans: Net Beans
QtCreator: Qt Creator
Step1
Save
it (.tar file) and extract it.
Following
command
(.tar.gz files)
tar -xzvf FILENAME.tar.gz
(.tar.bz2 files)
tar -xjvf FILENAME.tar.bz2
(.tar files)
tar -xvf FILENAME.tar
Extract the
files from the tarball into the directory using the above command
Create a new
directory for ns3 files.
Short explanation:
·
-x : Extract
·
-v : Verbose: show what is being extracted
·
-j : Type of compression, in this case bzip2
·
-f : Next comes the filename
Step 2
From the terminal run:
$cd
ns-allinone-3.24
Packages to be installed if not available
For
Ubuntu/Debian
The following list of packages
Switch to Super user (Su)
Ubuntu 14.10 release or other Debian
- C++ - minimal set of package needed to run ns-3
apt-get install gcc g++ python
Yum install gcc g++ python [Centos / Red hat / Fedora]
[g++ - *nix [package manager for linux /
Unix systems] based C++ compiler operated via command line]
- Python - minimal set of packages
apt-get install gcc g++ python
python-dev
[python-dev: Python Developer – design
issues, release and maintenance of existing release]
- Running python bindings from the ns-3 development
tree
(ns-3-dev [ development tree
– Mercurial server n building])
apt-get install bzr [File Format]
- Support for generating modified python bindings
[For python coding and python bindings - Python
bindings are used when an already existing C library written for some purpose
is to be used from Python]
cmake / qmake
cmake:
-
Compile source code, create libraries,
generate wrappers and build executables
-
Cross platform system; Supports much more libraries/tools; KDE [Kool Desktop
Environment] uses.
qmake:
-
Generation of Makefiles.
-
Makefiles are used by the
program make to build executable programs from source code
-
It integrates with
the Qt framework, and automates the creation of complier
apt-get install cmake
libc6-dev libc6-dev-i386 g++-multilib
install gccxml and pygccxml - python
bindings (bake build tool).
- Debugging:
apt-get install gdb [gnu debugger] valgrind [suite of tools for
debugging programs]
- GNU Scientific Library (GSL) support for more
accurate WiFi error models
apt-get install gsl-bin libgsl0-dev
libgsl0ldbl [GNU Scientific Library]
- gsl-bin: GNU Scientific
Library (GSL) -- binary package
- libgsl0-dbg: GNU Scientific
Library (GSL) -- debug symbols package
- libgsl0-dev: GNU Scientific
Library (GSL) -- development package
- libgsl0ldbl: GNU Scientific
Library (GSL) -- Library package
- The Network Simulation Cradle (nsc) requires the
flex lexical analyzer and bison parser generator:
apt-get install flex bison libfl-dev [ fast lexical analyser generator –
convert from sequence of character to sequence of tokens(strings)]
Tools designed for writers of
compilers and interpreters
- To read pcap packet traces
apt-get install tcpdump
powerful command-line packet
analyzer;
libpcap, a portable C/C++
library for network traffic capture.
It will be briefly discussed
in workshop session
- Database support for statistics framework
apt-get install sqlite sqlite3 libsqlite3-dev [SQL Database Engine with
SQL database]
- Xml-based version of the config store : libxml2 >= v2.7)
apt-get install libxml2
libxml2-dev [XML C parser]
- A GTK-based configuration system
GIMP Toolkit, is a multi-platform toolkit for creating
graphical user interfaces
apt-get install libgtk2.0-0
libgtk2.0-dev
- To experiment with virtual machines and ns-3
apt-get
install vtun lxc [ Virtual Tunnels over TCP/IP networks]
LXC (Linux Containers) is
an operating-system-levelvirtualization environment for running multiple
isolated Linux systems (containers) on a single Linux control host.
- Support for utils/check-style.py code style check
program
apt-get install uncrustify
A cross platform compatible
GUI for several code formatter, beautifier and indenter like GreatCode, AStyle,
GNU Indent, Uncrustify and many more.
- Doxygen and related inline documentation:
apt-get install doxygen graphviz
imagemagick
Doxygen
is the de facto standard tool for generating documentation from annotated C++
sources, but it also supports other popular programming languages such as C,
Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice
flavors), Fortran, VHDL, Tcl, and to some extent D.
Graphviz
is open source graph visualization software. Graph visualization is a way of
representing structural information as diagrams of abstract graphs and
networks. It has important applications in networking, bioinformatics, software engineering, database and web
design, machine learning, and in visual interfaces for other technical domains.
apt-get install texlive texlive-extra-utils
texlive-latex-extra texlive-font-utils dvipng
TeX Live is an easy way to get
up and running with the TeX document production system. It provides a comprehensive
TeX system with binaries for most flavors of Unix, including GNU/Linux, and
also Windows
- The ns-3 manual and tutorial Sphinx
(doc/tutorial, doc/manual, doc/models), and figures typically in dia
(texlive packages ):
apt-get install python-sphinx dia
Sphinx v>= 1.12 required
for ns-3.XX.
sudo easy_install -U Sphinx.
Since Sphinx is written in the
Python language, you need to install Python 2.6 and sphinx
- Support for Gustavo Carneiro's ns-3-pyviz visualizer
apt-get install python-pygraphviz
python-kiwi python-pygoocanvas libgoocanvas-dev
live simulation visualizer,
meaning that it uses no trace files.
Goocanvas are the python bindings for GooCanvas which is a canvas widget
for GTK+ that uses the cairo 2D library for drawing.
- Support for openflow module
apt-get install
libboost-signals-dev libboost-filesystem-dev
- Support for MPI-based distributed emulation
apt-get install openmpi-bin
openmpi-common openmpi-doc libopenmpi-dev
MPI (Message passing
interface) Boost libraries are intended to be widely useful, and usable across
a broad spectrum of applications.
When ur trying the above
command if it is not able to identify,
Try with the root user and type sudo apt-get update
Through
various system generated messages, we can check whether following packages are
present or not,
Type: Sudo apt-get (Yum for centos and fedora)
install autoconf
install automake
install gcc-c++
install libX11-devel
install xorg-x11-proto-devel
install libXt-devel
install libXmu-devel
If not,
In
terminal type,
sudo apt-get install gcc g++
python
sudo apt-get
install gcc g++ python python-dev
$./build.py
Processes
take some time to build.
Then
Type: $cd ns-3.24
now we
will validate our installation
$ ./waf configure
After
typing Configure, check whether the examples and tests are enabled or disabled.
If it is disenabled type,
$ ./waf configure
–enable-examples –enable-tests
To
utilize the predefined model source codes in ns3
$./test.py
It will
generate the following system messages:
Waf:
Entering directory `/ media/ Installations /ns-allinone-3.24/ns-3.24/build’
Waf:
Leaving directory `/media /Installations/ns-allinone-3.24/ns-3.24/build’
‘build’
finished successfully (2.010s)
PASS:
TestSuite lte-bearer
PASS:
TestSuite lte-propagation-loss-model
…………..
PASS:
Example src/contrib/flow-monitor/examples/wifi-olsr-flowmon.py
168
of 168 tests passed (168 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind
errors)
optional NS-3 features:
Python Bindings : enabled (Python library
or headers missing)
BRITE Integration : not enabled (BRITE not
enabled (see option --with-brite))
NS-3 Click Integration : not enabled (nsclick not enabled
(see option --with-nsclick))
GtkConfigStore : enabled (library
'gtk+-2.0 >= 2.12' not found)
XmlIo : enabled
(library 'libxml-2.0 >= 2.7' not found)
Threading Primitives : enabled
Real Time Simulator : enabled
Emulated Net Device : enabled
( include not detected)
Network Simulation
Cradle : enabled (architecture
None not supported)
MPI Support : enabled (option
--enable-mpi not selected)
NS-3 OpenFlow
Integration : not enabled
(Required boost libraries not found)
SQlite stats data output : enabled (library 'sqlite3' not
found)
Tap Bridge : enabled
( include not detected)
PyViz visualizer : enabled (Python Bindings
are needed but not enabled)
Use sudo to set suid
bit : enabled (option
--enable-sudo not selected)
Build tests : enabled (defaults to
disabled)
Build examples : enabled (defaults to
disabled)
GNU Scientific Library
(GSL) : enabled (GSL not found)
Ref. https://www.nsnam.org/wiki/Installation
To enable / Disable the above features
Sudo --enable-python
Sudo --disable-python
Option
|
Linux
|
FreeBSD
|
Mac OS X
|
Optimized
build
|
Y
|
Y
|
Y
|
Python
bindings
|
Y
|
Y
|
Y
|
Threading
|
Y
|
Y
|
Y
|
Real-time simulator
|
Y
|
Y
|
N
|
Emulated
Net Device
|
Y
|
N
|
N
|
Tap Bridge
|
Y
|
N
|
N
|
Network
simulation cradle
|
Y1
|
?
|
N
|
Static
builds
|
Y
|
Y
|
Y
|
Step 4
Now our ns3 is installed and ready to run
programs.
Waf:
Entering directory `/media/ Installations/ns-allinone-3.12/ns-3.12/build’
Waf:
Leaving directory `/media/ Installations/ns-allinone-3.12/ns-3.12/build’
‘build’
finished successfully (1.353s)
NS3 is
installed and running successfully.
Ref.
Errors:
1.
Type: sudo apt-get install gcc g++ python
sudo apt-get install gcc g++ python
python-dev
2. When I
run "./build.py" from my ns3-allinone directory - error:
In file included from
./ns3/hash-fnv.h:24:0,
from ./ns3/core-module.h:34,
from
../utils/bench-simulator.cc:27:
./ns3/hash-function.h: In
member function ‘virtual uint32_t ns3::Hash::Function::Hash64::GetHash32(const
char*, size_t)’:
./ns3/hash-function.h:147:39:
error: dereferencing type-punned pointer will break strict-aliasing rules
[-Werror=strict-aliasing]
cc1plus: all warnings
being treated as errors
Waf: Leaving directory
`/home/sony/repos/ns-3-allinone/ns-3-dev/build'
Build failed
-> task in 'bench-simulator' failed (exit
status 1):
{task 29716752: cxx bench-simulator.cc
-> bench-simulator.cc.2.o}
['/usr/bin/g++', '-O0',
'-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations',
'-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-I.', '-I..', '-DNS3_ASSERT_ENABLE',
'-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1',
'-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_SQLITE3=1',
'-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '../utils/bench-simulator.cc', '-c', '-o',
'utils/bench-simulator.cc.2.o']
Traceback (most recent
call last):
File "./build.py", line 170, in
sys.exit(main(sys.argv))
File "./build.py", line 161, in
main
build_ns3(config, build_examples,
build_tests, args, build_options)
File "./build.py", line 81, in build_ns3
run_command([sys.executable,
"waf", "build"] + build_options)
File
"/home/sony/repos/ns-3-allinone/util.py", line 24, in run_command
raise CommandError("Command %r exited
with code %i" % (argv, retval))
util.CommandError: Command
['/usr/bin/python', 'waf', 'build'] exited with code 1
Use
command,
sudo apt-get install g++ and gcc