Information

Documentation

Get OpenRDK at SourceForge.net. Fast, secure and Free Open Source software downloads

edit SideBar

Building OpenRDK (old version)

NOTE: this page contains instructions to build the OpenRDK up to version 2.1.5 or up to revision 275 of the Subversion repository. If you have a version greater than 2.1.5, or you checked out a revision greater than 275, please follow the instructions here

The last step of this introduction will be how to compile the OpenRDK code. This will enable us to begin programming and using it in the next part: First Contact.

Now you have two possibilities to compile OpenRDK: in-source and out-of-source.

OpenRDK supports in-source building and out-of-source building, starting from revision 6445. With the first option (in-source building), the build system will generate Makefiles and object files inside the source tree. This allows to compile directory-wise, i.e., compile only in the directory you are making changes. With out-of-source building, you are able to compile for different platforms without the need to have different source trees (e.g., you can compile OpenRDK for your machine and cross-compile for another). Note that you cannot compile in-source for your machine and cross-compile out-of-source for another machine: either you compile in-source for one architecture, or you compile out-of-source for different architectures (including yours). Cross-compilation is needed, for example, if you want to compile OpenRDK libraries and modules for Nao's Geode platform.

BIG FAT WARNING: in-source and out-of-source building are incompatibles!. If you want to use out-of-source building, please check if you have a CMakeCache.txt file in your src directory. If so, please remove it, as cmake will be confused by mixing the two methods.

In-source building

First of all, go in the sources directory of the OpenRDK and run cmake

  $ cd ./src
  $ cmake .

The cmake . command will create Makefiles that will be used for compilation. Before starting the compilation process, you should edit manual.cmake in order to choose the right subcomponents you want to compile. Every time you make changes to manual.cmake, you should run cmake . from src directory again (the first time cmake . is needed to create the manual.cmake). Please remember that cmake . need to be run only from the root src directory, never from subdirectories.

If you changed something in the manual.cmake run again:

  $ cmake .

Then you have to set the environment variables and start the compilation process:

  $ . setenv
  $ make

Out-of-source building

This method leaves the src directories clean by *.o and allow a single source tree and multiple building tree.

In particular you can have a normal building tree and a cross-compiled one. Just create two directory, e.g. build and build-cross, and compile inside each of them (changing the settings of course).

First of all, go in the sources directory of the OpenRDK and make a build directory before run cmake

  $ mkdir src/build
  $ cd ./src/build
  $ cmake ..

The cmake .. command will create Makefiles that will be used for compilation in the current building directory. This avoids the use of multiple OpenRDK with different flavor of building settings which is the usual method in pre-rev 6445 days.

Before starting the compilation process, you should edit manual.cmake in order to choose the right subcomponents you want to compile. Every time you make changes to manual.cmake, you should run cmake .. from src/build directory again (the first time cmake .. is needed to create the manual.cmake). Please remember that cmake .. need to be run only from the root src/build directory, never from subdirectories.

If you changed something in the manual.cmake run again:

  $ cmake ..

Then you have to set the environment variables and start the compilation process:

  $ . setenv
  $ make

After building OpenRDK two new directories will be created in the build (or root for in-source building) folder:

  • bin
  • lib (or lib64 if you are on a 64bit system)

In the bin directory all the binaries for running OpenRDK applications are placed. This directory is added to your PATH variable whenever you run . ../setenv (or . setenv)

In the lib (or lib64) directory are placed all the built libraries required for running OpenRDK.

Setting environment variables

The setenv command has to be issued from the OpenRDK source directory every time you want to run an RAgent or compile (also if you want to compile your own project, you need to go first in the OpenRDK source directory and do the setenv).

Tips'n'help: it is . (dot) and then setenv (or, otherwise, to be more verbose, source setenv).

Tips'n'help: it will simplify your future work if you modify the file ~/.bashrc. If you do this, every time you will run a shell it will be run the script setenv that sets all the required environment variables for the compilation and execution of the OpenRDK applications.

Add the following lines to your ~/.bashrc file (using whatever editor you like) if you are compiling in-source:

  OWD=$PWD
  cd <path-to-OpenRDK>/src
  . setenv >/dev/null
  cd $OWD

or these if you are compiling out-of-source:

  OWD=$PWD
  cd <path-to-OpenRDK>/src/<compilation-directory>
  . setenv >/dev/null
  cd $OWD

<compilation-directory> should be build for out-of-source compilation, if you followed the instructions above.

© 2004-2009 RoCoCo Laboratory Powered by PmWiki
Edit - History - Printable View - Recent Changes - Search
Page last modified on May 17, 2010, at 12:21 PM