Prerequisites for compiling OMNeT++ from the source

There are optional prerequisites that you can build OMNeT++ with, but on Linux you also need to make sure you have the correct mandatory prerequisites in order for OMNeT++ to build.

There are three optional packages which can be used to build OMNeT++. They are as follows:

  • MPI: This stands for message passing interface and is a message-passage library. This means that it is used for parallel programming that can be done across multiple machines with distribution memory. You may find this useful for OMNeT++ as it will allow you to speed up your simulations. Essentially, MPI will facilitate faster and more powerful simulations.
  • PCAP: This stands for packet capture, and it allows packets that are travelling through the local network to be captured.
  • Akaroa: Akaroa smartly collects data during the runtime of a simulation and stops the simulation once enough data has been collected to make a meaningful observation from that data. This tool is very useful for anyone who is trying to debug a network to make it more efficient and robust.

Installing OMNeT++ on Windows

All the prerequisites for installing OMNeT++ on Windows are actually included in the ZIP file that we have downloaded. This is why installing OMNeT++ on Windows is a lot easier than installing it on Linux. However, the optional packages are not included.

To get MPI for Windows, you first need Visual Studio Express for Windows desktop which can be found at http://www.microsoft.com/visualstudio/eng/downloads. Once you have installed Visual Studio, you just need to run the MPI installer provided by Open MPI that can be found at http://www.open-mpi.org/software/ompi/v1.6/. During the installation, make sure that the option to add MPI to the path is selected in the following manner:

Installing OMNeT++ on Windows

You need to edit the configure.user file found in your OMNeT++ folder in order to tell OMNeT++ where to find your MPI. If you read the configure.user file, you will find the instructions and examples on how to do this.

The PCAP implementation for Windows is called WinPcap and can be downloaded from http://www.winpcap.org/install/default.htm. When installing WinPcap, I recommend that you select the option to automatically start the WinPcap driver at boot time.

Unfortunately, Akaroa is not Windows-friendly and this book will not cover how to install it on the Windows operating system.

Installing OMNeT++ on Linux

I will show you how to install the MPI implementation for Linux, Open MPI. It provides a full implementation of the message-passing interface. To install, open your terminal and enter:

sudo apt-get install openmpi-bin libopenmpi-dev

You can also install Open MPI by using the synaptic package manager that is found on most of the popular Linux distributions.

The PCAP implementation for Linux is libpcap and can be installed from the terminal by entering the following command:

sudo apt-get install libpcap-dev

You can also install libpcap-dev by using the synaptic package manager.

Akaroa can be downloaded from http://www.cosc.canterbury.ac.nz/research/RG/net_sim/simulation_group/akaroa/download.chtml. You must first register to download the source code for Akaroa, as you need to compile it. Once you have downloaded the Akaroa tarball, you need to first extract it and then, using your terminal, move it into the extracted directory and enter the following command:

./configure
make
sudo make install

If there are any errors in this installation, please consult the documentation that is provided in the Akaroa folder which you just downloaded.

You must have some packages before you can compile OMNeT++; these can be downloaded and installed by entering the following command into your terminal:

sudo apt-get update && sudo apt-get install build-essential
gcc g++ bison flex perl 
tcl-dev tk-dev blt libxml2-dev 
xlib1g-dev openjdk-6-jre doxygen graphiz

Once you have installed these packages, you can learn more about them if you are curious by using the man command. Not every package will have a main page that you can view, it just depends whether one has been written or not. For example, to find out more about flex, you would enter the following command into your terminal:

man flex

Tip

Downloading the example code

You can download the example code files for all Packt books that you have purchased from your account at http://www.packtpub.com. If you purchase this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Compiling and installing on Windows

The process of compiling and installing on Windows is very self-contained. To compile and install, just follow the given steps:

  1. Enter the OMNeT++ directory that you unzipped earlier.
  2. Run the file called Mingwenv.cmd.
  3. When the terminal appears, enter the following command:
    ./configure
    make
    

Compiling and installing on Linux

To compile OMNeT++ on Linux, you must open up a terminal and move it to the extracted OMNeT++ folder that you downloaded earlier. Now enter the following command into your terminal:

./configure
make

On Ubuntu 12.10, I received the following error message when I tried to run the make command:

abspath.cc: In function 'std::string toAbsolutePath(const char*)':
abspath.cc:63:38: error: 'getcwd' was not declared in this scope

Thanks to the support of the OMNeT++ community online, I realized that the fix to the problem was editing abspath.cc that is found in src/utils/ of your extracted the OMNeT++ folder. Using the text editor of your choice, open abspath.cc and then add the following code onto line 21:

#include <unistd.h>

Save and close abspath.cc and rerun the make command. Once the last command has finished running, OMNeT++ will be installed. Making sure that you're still in the same directory in your terminal, you can now create a menu item from your terminal by typing the following command:

make install-menu-item

If you want to also create a desktop icon for OMNeT++, enter the following command into your terminal:

make install-desktop-icon
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.206.69