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.