Skip to content

All in one wiselib and shawn installation and integration

Henning Hasemann edited this page Jul 9, 2014 · 37 revisions

Table of Contents

Introduction

This tutorial 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, thus installation and configuration guide is included. The tutorial is based on the following outdated guides:

  1. https://github.com/CEID-DS/cbox/wiki/Installing-Wiselib-%26-shawn
  2. https://github.com/ibr-alg/wiselib/wiki/Direct-integration-shawn-application
  3. https://github.com/ibr-alg/wiselib/wiki/Config-files
  4. http://www.ceid.upatras.gr/courses/katanemhmena/ds2/images/files10-11/wiselib.pdf (in greek)
Obviously most credits go to these authors.

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. In debian based distros you can install them by typing:

sudo apt-get install git subversion build-essential cmake cmake-curses-gui libboost-thread-dev libcgal-dev freeglut3-dev libboost-regex-dev libboost-system-dev libcairo2-dev
Some debian systems may complain of not being able to find libcgal-dev. In such case, you need to add the following
deb ftp://ftp.mpi-sb.mpg.de/pub/outgoing/CGAL/debian squeeze main contrib non-free
deb-src ftp://ftp.mpi-sb.mpg.de/pub/outgoing/CGAL/debian squeeze main contrib non-free
to your `/etc/apt/sources.list` and run `sudo apt-get update`, before you can find this package. For more information, refer http://www.cgal.org/FAQ.html#debian_packages

Download Wiselib and Shawn

  • Download wiselib:
git clone https://github.com/ibr-alg/wiselib.git
  • Download shawn:
git clone https://github.com/itm/shawn.git

Configure Wiselib

  • The rest assume that you have downloaded wiselib and shawn in folder
  /home/<username>/wiselib and /home/<username>/shawn
  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
...
export SHAWN_LINK_LIBS=-rdynamic -lshawnlib -lapps_wiseliblib -lapps_topologylib -lapps_readinglib \
                       -lapps_testbedservicelib -lapps_exampleslib -lapps_externalapplib -lshawnlib \
                       -ldl -lboost_date_time -lboost_thread -lboost_system -lboost_regex -lapps_wisemllib \
					   -lapps_vislib -lapps_localizationlib -lcairo -lpng -lfreetype -lfontconfig -lz -lGL -lglut -lGLU
  • 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.

Configure Shawn

  • If you don't indent to use shawn you can skip this part

Shawn configuration

Attention: There is currently an issue with building shawn with BUILD_SINGLE_LIB set to ON, see https://github.com/ibr-alg/wiselib/issues/30 for details.

  • Create a folder libraries under shawn directory
mkdir ~/shawn/libraries
  • 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_EXAMPLES ON
MODULE_APPS_EXTERNAL_APPLICATION ON
MODULE_APPS_READING ON
MODULE_APPS_TOPOLOGY ON
MODULE_APPS_WISELIB ON
MODULE_APPS_LOCALIZATION ON
MODULE_APPS_VIS ON
OPT_ENABLE_SHAWN_REALTIME ON
OPT_ENABLE_BOOST ON
OPT_ENABLE_CAIRO ON
OPT_ENABLE_CGAL ON
OPT_ENABLE GLUT 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 and make other adjustments as shown below. Note that LIBRARY_OUTPUT_PATH needs to be changed to ..../shawn/libraries (is however usually set to ..../shawn/buildfiles by default!)
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
INCLUDE_PATH_BOOST=/usr/include/boost
INCLUDE_PATH_CAIRO=/usr/include/cairo
INCLUDE_PATH_CGAL=/usr/include/cgal
INCLUDE_PATH_CGAL_COMPILER_CON=
INCLUDE_PATH_GLUT=/usr/include/GL
LIB_PATH_BOOST=/usr/lib
LIB_PATH_CAIRO=/usr/lib
LIB_PATH_CGAL=/usr/lib
LIB_PATH_GLUT=/usr/lib
  • Type c & g
  • Execute: make
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 highly recommended.

Download Wiselib examples module into Shawn (Optional!)

Once the legacyapps folder is created, you can add Wiselib Shawn examples. Copy wiselib_examples

 cp ~/wiselib/apps/shawn_apps/wiselib_examples/ -r ~/shawn/src/legacyapps/
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

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 shawn.conf (The default processor when you build with target shawn is wiselib_shawn_standalone)
./example_app -f shawn.conf

Git Hints & Tips

Due to the fact, during the installation you have modified wiselib repository(and that's the way it meant to be) you must tell git to ignore these files. If you execute

git status
inside wiselib repository you should receive
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	apps/generic_apps/Makefile.local
#	apps/pc_apps/timer_test/timer_test
#	wiselib.stable/config.h
#	wiselib.testing/config_testing.h
In order to make git ignore these files you must create a .gitignore file inside the root wiselib directory:
touch ~/wiselib/.gitignore
Now add these lines in the .gitignore file:
apps/pc_apps/Makefile.base
apps/generic_apps/Makefile.local
apps/pc_apps/timer_test/timer_test
wiselib.stable/config.h
wiselib.testing/config_testing.h
.gitignore
The last line actually says to git to ignore .gitignore file too.

Troubleshooting

cairo.h not found

To resolve cairo.h not found errors use this work around:

sudo cp /usr/include/cairo/* /usr/include/

Expected unqualified-id... in vis_refresh_liveview.cpp

There might be an error looking like

vis_refresh_liveview.cpp:58:47: error: expected unqualified-id before
numeric constant
       boost::xtime_get(&last_refresh_, boost::TIME_UTC);

Run: gedit ~/shawn/src/apps/vis/events/vis_refresh_liveview.cpp and then rename all "TIME_UTC" to "TIME_UTC_"

Does not compile / Dependency Problems

The shawn and wiselib repositories in the VM are likely outdated, update both and try again!

When compiled with all features, shawn requires a lot of internal and external dependencies, some of which might not currently work or be available for different reasons. If your compile goes wrong, take a long stare at the error messages to take a guess, which modules cause the failure and disable them in ccmake.

The example here assumes a rather feature-rich shawn configuration, a more lightweight Makefile.local entry would be:

export SHAWN_LINK_LIBS=-rdynamic -lshawnlib -llegacyapps -lapps_exampleslib \
	-lapps_externalapplib -lshawnlib \
	-ldl
Clone this wiki locally