RTT on MS Windows

This page collects all the documentation users collected for building and using RTT on Windows. Note that Native Windows support is available from RTT 1.10.0 on, and that you might no longer need some of the proposed workarounds (such as using mingw or cygwin).

The recommended way of compiling the RTT on Windows is by using the Compiling on Windows with Visual Studio instructions.

Compiling RTT in Windows/MinGW Native API

Status

The native API port of RTT can be found in the 1.10.x releases. Only minor issues are left and most unit tests pass.
  • it is based solely on mingw32, no msys or cygwin.
  • it use native windows threads. No need for pthreads.
  • only ports RTT, CORBA is supported as well.
  • it uses the fixes that Peter made regarding 'weak' symbol handling.
  • 1 unit test is till doing difficult
  • Priorities are supported on thread level, though creating new processes could help get better "realtime" support.

This document is slightly outdated.

Compiling RTT

  • CMake is used to generate the project: cmake -G"MinGW Makefiles" .

Linking and Compiling an application

To have something sort of working under native Win32/Visual Studio 2003 using the MinGW Compiled RTT (with the patches).

Using the info here: http://www.mingw.org/old/mingwfaq.shtml#faq-msvcdll

I managed to create DEF files, and use Microsofts LIB tool to turn the library it into something MSVC likes.

I'm no CMake expert, and don't have the time to learn **another** build scripting language, however I created the CMake files in the usual way, built RTT and ensure it compiled cleanly. I hacked the created makefiles by a search of my source tree for "--out-implib" and found that link.txt that lives in build\src\CMakeFiles\orocos-rtt-dynamic_win32.dir had that string in it. So I added the --output-def,..\..\libs\liborocos-rtt-win32.dll.def, to create the def file, and rebuilt RTT, this created the DEF file, I than ran it through the Microsoft LIB tool as described.

I then created a MSVC project, added the library to my linker settings, and made a very simply MSVC console application:

#include "rtt\os\main.h"
#include "rtt\rtt-config.h"
 
int ORO_main(int, char**)
{
      return 0;
}

I also needed to setup my MSVC preprocessor definitions:

NDEBUG
_CONSOLE
__i386__
__MINGW32__
OROCOS_TARGET=win32

Hopefully I am now at a stage when I can actually start to evaluate RTT :-) If anyone has any ideas on how to properly get the CMakeList.txt to generate the DEF files without nasty post-CMake hacks, then I would love to hear it...

Compiling on Windows with Visual Studio

This page summarizes how to compile RTT with Microsoft Visual Studio, using the native win32 api. RTT supports Windows out of the box from RTT 1.10.0 and 2.3.0 on. OCL is supported from 1.12.0 and 2.3.0 on.

This tutorial assumes you extracted the Orocos sources and all its dependencies in c:\orocos

For new users, RTT/OCL v2.3.x or later is recommended, included in the Orocos Toolchain v2.3.x.

Rationale

We only support Visual Studio 2008 and 2005. Support for 2010 is on its way. You're invited to try VS2010 out and suggest patches to the orocos-dev mailing list.

Orocos does not come with a Visual Studio Solution. You need to generate one using the CMake tool which you can download from http://www.cmake.org. The most important step for CMake is to set the paths to where the dependencies of Orocos are installed. So before you can get to building Orocos, you need to build its dependencies, which don't use CMake, but their own build mechanism.

Only RTT and OCL of the toolchain are supported on Windows. The ruby based 'orogen' and 'typegen' tools, part of the toolchain, are not supported. Also ROS integration is not supported on Windows.

Important notice about Release or Debug

Debug and Release builds can not be mixed in Visual Studio's C++ compiler (you will have crashes when mixing a Debug and Release DLL that has a C++ API). By convention, a Debug .DLL can be recognized because it ends with ....d.dll. We recommend that you do Release builds when evaluating the Orocos toolchain and on production systems. Debug builds are considerably larger than Release builds.

RTT Dependencies

There are two major libraries required by RTT: Boost C++ and a CORBA transport library (if you require one).

CORBA using ACE/TAO (optional)

In case you require distributed Orocos components, you need to setup ACE/TAO, which does the work under the hood for RTT. Download the latest TAO version, extract it and open the solution (ACE_wrappers/TAO/TAO_ACE_vc8.sln) file with Visual Studio. Build the 'Naming_Service_vc8' project, and make sure that you choose the configuration (Debug/Release) that fits your purpose. The Naming_Service project builds automatically the right components we need to build RTT. Check the TAO build instructions in case you encounter problems.

You must have this set as system environment variables:

set ACE_ROOT=c:\orocos\ACE_wrappers
set TAO_ROOT=%ACE_ROOT%\tao
set PATH=%PATH%;%ACE_ROOT%\bin;%ACE_ROOT%\lib

You can also set these using Configuration -> System -> Advanced -> Environment Variables

CORBA using OMNIORB (optional)

Untested.

Boost (required)

While TAO builds, you might want to check out the pre-built boost libraries from boost-pro consulting on http://www.boostpro.com/download . Alternatively, get boost from http://www.boost.org and follow their build instructions. RTT 1.10.0 requires Boost 1.36.0 at least, since it requires the intrusive containers added in that release. RTT 2.3.0 or later require Boost 1.40.0. Note this bug for Boost 1.44.0: https://svn.boost.org/trac/boost/ticket/4487

We recommend Boost 1.40.0 for Windows. Also, unzip Boost with 7Zip or similar, but not with the default Windows unzip program, which is extremely slow.

Make sure to install these components: program_options, thread, unit_test_framework, filesystem, system.

Also add the lib directory to your PATH system environment variable:

set PATH=%PATH%;c:\orocos\boost_1_40\lib

CMake (required)

Download and install cmake (http://www.cmake.org). We're going to use cmake-gui.exe to configure our build system. Use CMake version 2.6.3 or newer.

XML Parser

RTT will use its internal 'tinyxml' parser on Windows. No need to install anything for this.

Setting up CMake

First you need to add two 'PATH' entries for telling cmake where Boost and TAO are installed. In the top RTT directory, there is a file named orocos-rtt.default.cmake. Copy it to orocos-rtt.cmake (in the same directory) and add these two lines:
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} 
    "c:/orocos/boost_1_40;c:/orocos/ACE_wrappers;c:/orocos/ACE_wrappers/TAO;c:/orocos/ACE_wrappers/TAO/orbsvcs")
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} 
    "c:/orocos/boost_1_40/lib;c:/orocos/ACE_wrappers/lib")
(note the forward-slashes, even on Windows!) Edit these lines to use your Boost version and install location. The OROCOS_TARGET should be automatically detected. If not, add:
set( OROCOS_TARGET win32 CACHE STRING 
     "The Operating System target. One of [lxrt gnulinux xenomai macosx win32]")
and remove the lines with references to other OROCOS_TARGET settings.

Start the cmake-gui and set your source and build paths ( For example, c:\orocos\orocos-rtt-1.10.0 and c:\orocos\orocos-rtt-1.10.0\build ). Now click 'Configure' at the bottom. Check that there are no errors. If components are missing, you probably need to fix the above PATHs.

  • For RTT 1.12, turn OS_NO_ASM ON, for RTT 2.3.0, turn OS_NO_ASM OFF.

You probably need to click Configure again and then click 'Generate', which will generate your Visual Studio solution and project files in the 'build' directory.

Open the generated solution in MSVS and build the 'ALL_BUILD' target, which will build the RTT (and the unit tests if you enabled them).

Unit tests (Optional)

In order to enable unit tests, you need to turn on BUILD_TESTING in the CMake GUI.

The unit tests will fail if the required DLLs are not in your path. In your system settings, or on the command prompt of Windows, add c:\orocos\boost_1_40\lib and c:\orocos\ACE_wrappers\lib to your PATH environment (reboot if necessary).

Next, run a 'make install' and add the c:\orocos\bin directory to your PATH (or whatever you used as install path.) In RTT 2.3.0, the default install path is c:\Program Files\orocos (so add c:\Program Files\orocos\bin to PATH). It is recommended to keep this default, since OCL uses that too.

Now you should be able to run the unit tests. The process could be a bit streamlined more and may be improved in later releases.

Installing RTT

Once everything is build, you can use the 'INSTALL' project to copy the files into the correct installation directories. This is necessary for OCL and the other Orocos applications such that they find headers and libraries in the expected locations.

Building OCL

Building OCL on Windows follows a similar path as RTT. Start CMake and point it to your OCL source tree and create a 'build' directory in there.

OCL Dependencies

Also OCL needs to know where Boost, TAO and other dependencies are installed. There's again an orocos-ocl.default.cmake file which you can copy to orocos-ocl.cmake.

There is a separate Wiki page for enabling Readline (tab-completion) in the TaskBrowser. See Taskbrowser with readline on Windows.

Missing Features on Windows

  • The RTT on Windows is not real-time ! It exists for convenience, simulation, and use by Windows GUIs.

Compiling the RTT on Windows/cygwin

This page describes all steps you need to take in order to compile the real-time toolkit on a Windows machine. We rely on the Cygwin libraries and tools to accomplish this. Visual Studio or mingw32 are as of this writing not yet supported. Also CORBA is not yet ported.

Download and install Cygwin

You can get it from http://www.cygwin.com and use the setup.exe script. Make sure you additionally install:
  • From 'Devel': binutils, boost, boost-devel, cmake, cppunit, gcc4-g++, libncurses-devel, make, readline, subversion

Download, install and patch RTT

The official RTT release does not yet include cygwin support. You need to download the RTT 1.6 sources in your cygwin environment and apply the patch in attachment:
 cd orocos-rtt; patch -p1 < orocos-rtt-cygwin.patch
The patch can be found here: https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=605

Build RTT

Create a build directory in the orocos-rtt directory (mkdir build) and run:
 cmake .. -DBOOST=/usr/include/boost-1_33_1
 make
This is a slow process. If you have multiple CPU cores, use 'make -j2' or -jN with N cores. In case you want to change more option, type 'ccmake ..' between the cmake and make commands.

Set your PATH

Cygwin relies on the PATH environment variable to locate the Orocos DLL's. From your build directory, type:
 export PATH=$PATH:`pwd`/src

Test your setup

Next test your setup with a 'make check' (add -jN). No more than 2 tests should fail, all related to timing.

Install your setup

Do 'make install'. The RTT will by default be installed in /usr/local. You don't need to add the /usr/local/lib directory to your PATH.