4. Windows installation from sources

The instructions for installing both the Fast DDS library and the Fast DDS-Gen generation tool from sources are provided in this page. It is organized as follows:

4.1. Fast DDS library installation

This section provides the instructions for installing eProsima Fast DDS in a Windows environment from sources. The following packages will be installed:

  • foonathan_memory_vendor, an STL compatible C++ memory allocator library.

  • fastcdr, a C++ library that serializes according to the standard CDR serialization mechanism.

  • fastrtps, the core library of eProsima Fast DDS library.

First of all, the Requirements and Dependencies detailed below need to be met. Afterwards, the user can choose whether to follow either the colcon) or the CMake) installation instructions.

4.1.1. Requirements

The installation of eProsima Fast DDS in a Windows environment from sources requires the following tools to be installed in the system:

4.1.1.1. Visual Studio

Visual Studio is required to have a C++ compiler in the system. For this purpose, make sure to check the Desktop development with C++ option during the Visual Studio installation process.

If Visual Studio is already installed but the Visual C++ Redistributable packages are not, open Visual Studio and go to Tools -> Get Tools and Features and in the Workloads tab enable Desktop development with C++. Finally, click Modify at the bottom right.

4.1.1.2. Chocolatey

Chocolatey is a Windows package manager. It is needed to install some of eProsima Fast DDS’s dependencies. Download and install it directly from the website.

4.1.1.3. CMake, pip, wget and git

These packages provide the tools required to install eProsima Fast DDS and its dependencies from command line. Download and install CMake, pip, wget and git by following the instructions detailed in the respective websites. Once installed, add the path to the executables to the PATH from the Edit the system environment variables control panel.

4.1.1.4. Gtest

GTest is a unit testing library for C++. By default, eProsima Fast DDS does not compile tests. It is possible to activate them with the opportune CMake configuration options when calling colcon or CMake. For more details, please refer to the CMake options section. For a detailed description of the Gtest installation process, please refer to the Gtest Installation Guide.

4.1.2. Dependencies

eProsima Fast RTPS has the following dependencies, when installed from sources in a Windows environment:

4.1.2.1. Asio and TinyXML2 libraries

Asio is a cross-platform C++ library for network and low-level I/O programming, which provides a consistent asynchronous model. TinyXML2 is a simple, small and efficient C++ XML parser. They can be downloaded directly from the links below:

After downloading these packages, open an administrative shell with PowerShell and execute the following command:

choco install -y -s <PATH_TO_DOWNLOADS> asio tinyxml2

where <PATH_TO_DOWNLOADS> is the folder into which the packages have been downloaded.

4.1.2.2. OpenSSL

OpenSSL is a robust toolkit for the TLS and SSL protocols and a general-purpose cryptography library. Download and install the latest OpenSSL version for Windows at this link. After installing, add the environment variable OPENSSL_ROOT_DIR pointing to the installation root directory.

For example:

OPENSSL_ROOT_DIR=C:\Program Files\OpenSSL-Win64

4.1.3. Colcon installation

colcon is a command line tool based on CMake aimed at building sets of software packages. This section explains how to use it to compile eProsima Fast DDS and its dependencies.

Important

Run colcon within a Visual Studio prompt. To do so, launch a Developer Command Prompt from the search engine.

  1. Install the ROS 2 development tools (colcon and vcstool) by executing the following command:

    pip install -U colcon-common-extensions vcstool
    

    and add the path to the vcs executable to the PATH from the Edit the system environment variables control panel.

    Note

    If this fails due to an Environment Error, add the --user flag to the pip installation command.

  2. Create a Fast-DDS directory and download the repos file that will be used to install eProsima Fast DDS and its dependencies:

    mkdir ~\Fast-DDS
    cd ~\Fast-DDS
    wget https://raw.githubusercontent.com/eProsima/Fast-DDS/master/fastrtps.repos
    mkdir src
    vcs import src < fastrtps.repos
    

    Finally, use colcon to compile all software:

    colcon build
    

Note

Being based on CMake, it is possible to pass the CMake configuration options to the colcon build command. For more information on the specific syntax, please refer to the CMake specific arguments page of the colcon manual.

4.1.3.1. Run an application

When running an instance of an application using eProsima Fast DDS, the colcon overlay built in the dedicated Fast-DDS directory must be sourced. There are two possibilities:

  • Every time a new shell is opened, prepare the environment locally by typing the command:

    setup.bat
    
  • Add the sourcing of the colcon overlay permanently, by opening the Edit the system environment variables control panel, and adding ~/Fast-DDS/install/setup.bat to the PATH.

4.1.4. CMake installation

This section explains how to compile eProsima Fast DDS with CMake, either locally or globally.

4.1.4.1. Local installation

  1. Open a command prompt, and create a Fast-DDS directory where to download and build eProsima Fast DDS and its dependencies:

    mkdir ~\Fast-DDS
    
  2. Clone the following dependencies and compile them using CMake.

    • Foonathan memory

      cd ~\Fast-DDS
      git clone https://github.com/eProsima/foonathan_memory_vendor.git
      cd foonathan_memory_vendor
      mkdir build && cd build
      cmake ..  -DBUILD_SHARED_LIBS=ON
      cmake --build . --target install
      
    • Fast CDR

      cd ~\Fast-DDS
      git clone https://github.com/eProsima/Fast-CDR.git
      cd Fast-CDR
      mkdir build && cd build
      cmake ..
      cmake --build . --target install
      
  3. Once all dependencies are installed, install eProsima Fast DDS:

    cd ~\Fast-DDS
    git clone https://github.com/eProsima/Fast-DDS.git
    cd Fast-DDS
    mkdir build && cd build
    cmake ..
    cmake --build . --target install
    

4.1.4.2. Global installation

To install eProsima Fast DDS system-wide instead of locally, remove all the flags that appear in the configuration steps of Fast-CDR and Fast-DDS.

Note

By default, eProsima Fast DDS does not compile tests. However, they can be activated by downloading and installing Gtest.

4.1.4.3. Run an application

When running an instance of an application using eProsima Fast DDS, it must be linked with the library where the packages have been installed. This can be done by opening the Edit system environment variables control panel and adding to the PATH the Fast DDS and Fast CDR installation directories:

  • Fast DDS: C:\Program Files\fastrtps

  • Fast CDR: C:\Program Files\fastcdr

4.2. Fast DDS-Gen installation

This section outlines the instructions for installing Fast DDS-Gen in a Windows environment from sources. Fast DDS-Gen is a Java application that generates source code using the data types defined in an IDL file. Please refer to Introduction for more information.

4.2.1. Requirements

In order to compile Fast DDS-Gen, the following packages need to be installed in the system:

4.2.1.1. Java JDK

The JDK is a development environment for building applications and components using the Java language. Download and install it at the following the steps given in the Oracle website.

4.2.1.2. Gradle

Gradle is an open-source build automation tool. Download and install the last stable version of Gradle in the preferred way.

4.2.2. Compiling Fast DDS-Gen

Once the requirements above are met, install Fast DDS-Gen by following the steps below:

cd ~
git clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git
cd Fast-DDS-Gen
gradle assemble

4.2.2.1. Contents

The Fast-DDS-Gen folder contains the following packages:

  • share/fastrtps, where the generated Java application is.

  • scripts, containing some user friendly scripts.

    Note

    To make these scripts accessible from any directory, add the scripts folder path to the PATH environment variable.