Skip to content

All in one wiselib and shawn installation and integration

vasilakis edited this page Mar 25, 2012 · 37 revisions

Table of Contents

Introduction

This guide was created to help programmers and mostly users to use Wiselib and shawn. Although this repo is about wiselib, shawn is a powerful simulator that helps a lot when you want to simulate algorithms you create in wiselib.

Requirements

Although this guide was tested under lubuntu environment, it should work for any linux based machine(and also in windows under cygwin but it's not recommended). You should have installed git and svn. In debian based distros you can install them by typing:

sudo apt-get install git subversion

Download Wiselib and Shawn

  • Download wiselib:
git clone https://github.com/ibr-alg/wiselib.git
  • Download shawn:
svn co https://shawn.svn.sourceforge.net/svnroot/shawn

Configure Wiselib

  • The rest assume that you have downloaded wiselib and shawn in folder /home/<username>/wiselib and /home/&lt;username&gt;&lt;/username&gt&lt;/shawn&gt;</username>respectively. If its not the case, please change the commands bellow approprietly.
  • Copy std_config.h to config.h
cp ~/wiselib/wiselib.stable/std_config.h ~/wiselib/wiselib.stable/config.h
  • Copy std_config_testing.h to config_testing.h
cp ~/wiselib/wiselib.testing/std_config_testing.h ~/wiselib/wiselib.testing/config_testing.h
  • Copy wiselib/apps/generic_apps/Makefile.template to wiselib/apps/generic_apps/Makefile.local
cp ~/wiselib/apps/generic_apps/Makefile.template ~/wiselib/apps/generic_apps/Makefile.local
  • Edit the wiselib/apps/generic_apps/Makefile.local: Set the WISELIB_BASE and the SHAWN_INCLUDE_DIR to the correct full paths and change the SHAWN_LINK_LIBS
pico wiselib/apps/generic_apps/Makefile.local
export WISELIB_BASE=/home/<username>/wiselib
...
export SHAWN_INCLUDE_DIR=/home/<username>/shawn
...
export SHAWN_LIB_DIR=$(SHAWN_INCLUDE_DIR)/libraries
...
#Small example with only basic libs
#export SHAWN_LINK_LIBS=-rdynamic -lshawnlib -llegacyapps -lapps_exampleslib \
        -lapps_externalapplib -lshawnlib \
        -ldl
...
#Full example with most libs
export SHAWN_LINK_LIBS=-rdynamic -lshawnlib -lapps_wiseliblib -lapps_topologylib -lapps_readinglib \
                       -lapps_testbedservicelib -lapps_exampleslib -lapps_externalapplib -lshawnlib \
                       -ldl -lboost_date_time-mt -lboost_thread-mt -lapps_wisemllib
As seen above, you comment the small example export and uncomment the full example export.
  • Now you should be able to use wiselib. Keep in mind that we have not set up shawn yet. To test that wiselib works navigate to apps/pc_apps/timer_test and hit make. Then by running timer_test you should receive "It's time!" message.
    • As of 25-03-2012 there was a tiny bug in the file apps/pc_apps/Makefile.base. Make sure in that file that there is:
WISELIB_PATH=../../..

Configure Shawn

  • If you don't indent to use shawn you can skip this part
The required Wiselib module is already part of Shawn. However, it is possible to add Wiselib examples to Shawn. Therefore, a legacyapps-Folder must be created, which can contain additional modules. The next two sub-sections are optional, but recommended.

Creating Legacyapps (Optional!)

First of all, the Wiselib module must be added to Shawn. Since it is not yet part of the official Shawn release, it must be added as a legacy application (described in Shawn Wiki). Basically, this only requires three steps:

  • Create a folder where your Shawn legacy applications should be located (for instance, at shawn/src/legacyapps - in parallel to the existing apps and sys directories)
  • Copy legacyapps_init.h and legacyapps.cpp to this newly created folder
  • Go to shawn/buildfiles, call ccmake ../src, and set CONFIGURE_LEGACYAPPS to ON. Then press "c", "g", and "q" .

Download Wiselib examples module into Shawn (Optional!)

Once the legacyapps folder is created, you can add Wiselib Shawn examples. Optionally (but recommended) check out

 git clone https://github.com/ibr-alg/wiselib/tree/master/apps/shawn_apps/wiselib_examples
into legacyapps, because it contains examples of how to integrate Wiselib algorithms into own applications.

Afterward, the directory structure should look as follows:

shawn/src/legacyapps/wiselib_examples

Shawn configuration

  • Goto the shawn/buildfiles directory
cd ~/shawn/buildfiles
  • Execute: ccmake ../src
  • Type c
  • Check the status of the following features:
BUILD_LIB_WITH_MAIN ON
BUILD_SINGLE_LIB OFF 
CONFIGURE_APPS ON 
  • Type c
  • Check the status of the following features:
MODULE_APPS_EXTERNAL_APPLICATION ON
MODULE_APPS_EXAMPLES ON
MODULE_APPS_READINGS ON
MODULE_APPS_TOPOLOGY ON
MODULE_APPS_WISELIB ON
OPT_ENABLE_SHAWN_REALTIME ON
  • Type c
  • Set INCLUDE_PATH_WISELIB_STABLE and INCLUDE_PATH_WISELIB_TESTING to the full path of your wiselib/wiselib.stable and wiselib/wiselib.testing directories
INCLUDE_PATH_WISELIB_STABLE=/home/<username>/wiselib/wiselib.stable
INCLUDE_PATH_WISELIB_TESTING=/home/<username>/wiselib/wiselib.testing
LIBRARY_OUTPUT_PATH=/home/<username>/shawn/libraries
  • Type c & g
  • Execute: make

Run an application

Test that your installation works, compile a test wiselib application for shawn:

  • Goto the wiselib/apps/generic_apps/example_app
cd wiselib/apps/generic_apps/example_app
  • Type make shawn
make shawn
  • Execute: ./example_app -f test.conf (The default processor when you build with target shawn is wiselib_shawn_standalone)
./example_app -f test.conf