Ikaros for Linux

These are the Linux specific instructions on how to compile Ikaros using the included Code::Blocks project and how to make a new Ikaros project.

Instructions of how to run Ikaros, both from the IDE and from the terminal, and how to add a new module to the project are also included.

The software, used in this document, is listed in the end of the document. Ikaros will most likely work with later package than those listed here.

Compile Ikaros with the included Code::Blocks project file

  1. Download and install Code::Blocks. The project file included with Ikaros distribution is created with Code::Blocks version 10.05.
  2. The next step is to install the compiler and external libraries. The easiest way to install the packaged in Ubuntu is to use the apt-get command.
    Simply copy this command to Linux terminal:
    sudo apt-get install libpng-dev g++ libgsl0-dev libjpeg62-dev
    
  3. Start Code::Blocks.
  4. Open the Code::Blocks project ('<ikaros dir>/Linux/Code Blocks/ikaros/ikaros.cbp').
  5. Compile.

Creating a new Ikaros project in Code::Blocks

This document explain how to compile Ikaros using the open source cross platform IDE Code::Blocks.

  1. Download and install Code::Blocks.
  2. The next step is to install the compiler and external libraries. The easiest way to install the packaged in Ubuntu is to use the apt-get command.
    Simply copy this command to Linux terminal:
    sudo apt-get install libpng-dev g++ libgsl0-dev libjpeg62-dev
  3. Start Code::Blocks.
  4. Create a new "Console application" project.
  5. Follow the guide to create the project.
  6. After completing the guide a Ikaros project have been created. Remove, both in project and on the hard drive, the main.cpp that the project guide created.
  7. Choose Project->Add files recursively and add all *.h and *.cc in the Ikaros Source directory. Add the files to both Debug and Release target.
  8. Choose Project-> Project build options and add the following properties for both of the targets.
    	
    Compiler settings
    Add "LINUX" in #defines.
    Linker settings
    Add the following libraries to Link libraries:
    gslcblas
    jpeg
    pthread
    png
    z
    
    Search directories
    add "../../../Source" to Compiler search directory.
    
  9. The next step is to change the working directory and the binary output for both targets. Chose Project->Properties and change to "Build target" settings.
    If you prefer to have the Ikaros binary file somewhere else then '<ikaors dir>/Bin/', you have to change the path from the binary file to the Ikaros root path. This can be done by defining the IKAROSPATH in IKAROS_system.h.
    Output filename
    ../../../Bin/ikaros
    Execution working
    ../../../Bin
    
  10. Compile

Alternative: compile Ikaros using a Code::Blocks generated Makefile

These are the Linux specific instructions on how to compile Ikaros using only command-line tools.

Run the following commands in the terminal:

sudo apt-get install libpng-dev g++ libgsl0-dev libjpeg62-dev
cd <ikaros dir>/Linux/CBGenMakefile/ikaros/ 
make

Running Ikaros

To run Ikaros you can either run it directly from Code::Blocks or use the terminal. For each Ikaros simulation you need to provide an Ikaros control file. In Code::Blocks the Ikaros control file can be changed by specifying the "set programs' argument" in the "Project" file menu. It is best to use a relative path to the ikc file here, for example: '../Examples/web_ui_objects.ikc', since this allows the project to be moved around.

When the control file is set in Code::Blocks, press the "Run" button to start Ikaros.

If you also add '-w' as an argument Ikaros will let you monitor the simulation by using a web browser. Enter 127.0.0.1:8000 into Chrome and Ikaros will present an graphical representaion of the simulation.

To run Ikaros using a shell prompt write the following:

> ./ikaros experimentfile.ikc

Here, "experimentfile.ikc" is the path to the experiment you want to run. Example ikc-files are available in the Examples directory. Note that the Ikaros binary must be placed at the correct location relative to the Source directory. If you move the binary from the Ikaros/Bin directory or set up your path so that Ikaros/Bin in in your search path, you need to change IKAROSPATH in IKAROS_System.h to point to the absolute location of the Ikaros directory.

Command line options can also be specified here.

Adding a module to the Ikaros project

While quite easy to add another module to the simulator it does involve a few steps. The idea is to create a new folder to hold the module, add the folder to the project, add a bit of documentation (you will thank yourself for doing this), and tell the system to add the module to the Ikaros.

  1. Create a new folder in UserModules. The easiest way to do this is to go to UserModules and copy the 'MyModule' folder; do not forget to rename the folder as well.
  2. Add your code as appropriate. In the 'Modules/Examples' directory, there are some simple example modules to look at.
  3. Edit the ikc-file to add documentation.
  4. Add the module to 'UserModules.h', i. e. add the .h file and a line with the AddClass call. Copy and rename one of the lines.

An example on how to write an Ikaros module can be found here.

The software used when creating this document

OS

Ubuntu Linux
http://www.ubuntu.com/
Ubuntu 11.10

IDE

Code::Blocks
http://www.codeblocks.org/
Code::Blocks 10.05.

Ikaros

Ikaros http://www.ikaros-project.org/
Ikaros 1.3

External libraries

Independent JPEG Group
http://www.ijg.org/
libjpeg62-dev

GSL - GNU Scientific Library
http://www.gnu.org/software/gsl/
libgsl0-dev
Only GSL's BLAS functions are used.

POSIX Threads
libpthread-dev

PNG Libary
http://www.libpng.org/
libpng12-dev

L Libary
http://www.zlib.net/
zlib1g-dev