Jump to content

Policy-based Resilience Simulator with OMNeT++/Building OMNeT++

From Wikibooks, open books for an open world

Note: Please take a look at official install guide before proceeding. Keep it open in a tab, because there will be references to that guide during the build process. You can get the latest OMNeT++ from here. If you are trying to set-up a Policy-based Resilience Simulator, you will have to use OMNeT++ 4.1, which can be downloaded from here.

Note: Now on, omnetpp-4.x folder in your home will be referred as "omnetpp folder" from now on.

Building OMNeT++

[edit | edit source]

Unpack the .tar.gz file you just downloaded

To build OMNeT++ 4.1/4.2/4.2.2, you need to make the following edit:

For OMNeT++ 4.1 and 4.2(.2), soon after unpacking OMNeT++ .tar.gz package, open file abspath.cc located in src/utils in your omnetpp folder and add following line in the beginning of the file:

#include <unistd.h>

In case you already ran configure script and got the error, delete the omnetpp folder in your home, unpack it again, make the change.

Now, install the required dependencies (distro specific) mentioned in the install guide. Then open terminal and run

Note: Here, replace "<version number>" with version you are trying to build.

cd omnetpp-<version number>
./configure

Towards the end, the configure script will show some warning similar to:

WARNING: your PATH doesn't contain /home/jesse/omnetpp-4.1/bin!
Add the following line to your .profile or .bash_profile (provided you use bash):
export PATH=$PATH:/home/jesse/omnetpp-4.1/bin

WARNING: The TCL_LIBRARY environment variable is not set, and without it Tkenv (the GUI runtime environment) may be unable to find the BLT library.
Add the following line to your .profile or .bash_profile (provided you use bash):
export TCL_LIBRARY=/usr/share/tcltk/tcl8.5

To do this, open the

.profile

file (located in Home folder, it'll be hidden-click View>Show Hidden Files or Ctrl+H to see it) with your favorite text editor, copy paste those lines to the end of the file. The added lines will look like this:

export TCL_LIBRARY=/usr/share/tcltk/tcl8.5
export PATH=$PATH:/home/<username>/omnetpp-4.1/bin

After this, close, and re-open terminal OR run

source .profile

Navigate back to omnetpp directory, and run

./configure

again. Now we are all set to compile OMNeT++. Run

make

It'll take some 10-20 minutes to compile, once it is done you can start OMNeT++ by typing:

omnetpp

Your simulator IDE should now start.

Testing your build

[edit | edit source]

OMNeT++ IDE, in first run you might be asked to "Select a Workspace", just go with the default one already over there. First you will be welcomed with a Welcome tab, you can close/ minimize it to get the full IDE.

You can test if your install is successful by running an example. Right click any of the examples there, say dyna, click "Open Project", now click the down arrow next to the green play button in toolbar, click Run As > OMNeT++ Simulation.

Now few windows should pop up, where the simulation runs if you click on the "Run" button in the tkenv window that pops up.

Troubleshooting

[edit | edit source]

On running example, if nothing happens and instead OMNeT++ gives an error like

<!> Error during startup: No user interface (Cmdenv, Tkenv, etc.) found.

in Console tab, this bug will be of some help. This error was noticed in OMNeT++ 4.1 in both Xubuntu (13.04, 12.10) and Linux Mint 14.

Make sure you close the IDE before recompiling it after installing necessary dependencies. If that doesn't solve your issue, or in case of any other difficulties, you can try asking for help in the OMNeT++ Mailing List.

If you are a new to OMNeT++, follow this link to get a general idea on how to play with OMNeT++. You can learn few Tips and Tricks here.

You can now proceed to compiling INET.

Basics · Compiling INET