1. Linux installation from sources¶
The instructions for installing the DDS Router application from sources and its required dependencies are provided in this page. It is organized as follows:
1.1. Dependencies installation¶
DDS Router depends on eProsima Fast DDS library and certain Debian packages. This section describes the instructions for installing DDS Router dependencies and requirements in a Linux environment from sources. The following packages will be installed:
foonathan_memory_vendor
, an STL compatible C++ memory allocation library.fastcdr
, a C++ library that serializes according to the standard CDR serialization mechanism.fastrtps
, the core library of eProsima Fast DDS library.cmake_utils
, an eProsima utils library for CMake.cpp_utils
, an eProsima utils library for C++.
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.
1.1.1. Requirements¶
The installation of DDS Router in a Linux environment from sources requires the following tools to be installed in the system:
Colcon [optional]
Gtest [for test only]
PyYAML [for YAML Validator only]
jsonschema [for YAML Validator only]
1.1.1.1. CMake, g++, pip, wget and git¶
These packages provide the tools required to install DDS Router and its dependencies from command line. Install CMake, g++, pip, wget and git using the package manager of the appropriate Linux distribution. For example, on Ubuntu use the command:
sudo apt install cmake g++ pip wget git
1.1.1.2. Colcon¶
colcon is a command line tool based on CMake aimed at building sets of software packages. Install the ROS 2 development tools (colcon and vcstool) by executing the following command:
pip3 install -U colcon-common-extensions vcstool
Note
If this fails due to an Environment Error, add the --user
flag to the pip3
installation command.
1.1.1.3. Gtest¶
Gtest is a unit testing library for C++. By default, DDS Router does not compile tests. It is possible to activate them with the opportune CMake 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.
It is also possible to clone the Gtest Github repository into the DDS Router workspace and compile it with colcon as a dependency package. Use the following command to download the code:
git clone --branch release-1.11.0 https://github.com/google/googletest src/googletest-distribution
1.1.1.4. PyYAML¶
PyYAML is a YAML parser and emitter for Python.
It is used by the DDS-Router YAML Validator for loading the content of configuration files.
Install pyyaml
by executing the following command:
pip3 install -U pyyaml
1.1.1.5. jsonschema¶
jsonschema is an implementation of the JSON Schema specification for Python.
It is used by the DDS-Router YAML Validator for performing validation of configuration files against a given JSON schema.
Install jsonschema
by executing the following command:
pip3 install -U jsonschema
1.1.2. Dependencies¶
DDS Router has the following dependencies, when installed from sources in a Linux environment:
1.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. Install these libraries using the package manager of the appropriate Linux distribution. For example, on Ubuntu use the command:
sudo apt install libasio-dev libtinyxml2-dev
1.1.2.2. OpenSSL¶
OpenSSL is a robust toolkit for the TLS and SSL protocols and a general-purpose cryptography library. Install OpenSSL using the package manager of the appropriate Linux distribution. For example, on Ubuntu use the command:
sudo apt install libssl-dev
1.1.2.3. yaml-cpp¶
yaml-cpp is a YAML parser and emitter in C++ matching the YAML 1.2 spec, and is used by DDS Router application to parse the provided configuration files. Install yaml-cpp using the package manager of the appropriate Linux distribution. For example, on Ubuntu use the command:
sudo apt install libyaml-cpp-dev
1.1.2.4. eProsima dependencies¶
If it already exists in the system an installation of Fast DDS library with version greater than 2.4.0, just source this library when building the DDS Router application by using the command:
source <fastdds-installation-path>/install/setup.bash
In other case, just download Fast DDS project from sources and build it together with DDS Router using colcon as it is explained in section Colcon installation.
1.2. Colcon installation¶
Create a
DDS-Router
directory and download the.repos
file that will be used to install DDS Router and its dependencies:mkdir -p ~/DDS-Router/src cd ~/DDS-Router wget https://raw.githubusercontent.com/eProsima/DDS-Router/main/ddsrouter.repos vcs import src < ddsrouter.repos
Note
In case there is already a Fast DDS installation in the system it is not required to download and build every dependency in the
.repos
file. It is just needed to download and build the DDS Router project having sourced its dependencies. Refer to section eProsima dependencies in order to check how to source Fast DDS library.Build the packages:
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.
1.3. CMake installation¶
This section explains how to compile DDS Router with CMake, either locally or globally.
1.3.1. Local installation¶
Create a
DDS-Router
directory where to download and build DDS Router and its dependencies:mkdir ~/DDS-Router
Clone the following dependencies and compile them using CMake.
-
cd ~/DDS-Router git clone https://github.com/eProsima/foonathan_memory_vendor.git mkdir foonathan_memory_vendor/build cd foonathan_memory_vendor/build cmake .. -DCMAKE_INSTALL_PREFIX=~/DDS-Router/install -DBUILD_SHARED_LIBS=ON cmake --build . --target install
-
cd ~/DDS-Router git clone https://github.com/eProsima/Fast-CDR.git mkdir Fast-CDR/build cd Fast-CDR/build cmake .. -DCMAKE_INSTALL_PREFIX=~/DDS-Router/install cmake --build . --target install
-
cd ~/DDS-Router git clone https://github.com/eProsima/Fast-DDS.git mkdir Fast-DDS/build cd Fast-DDS/build cmake .. -DCMAKE_INSTALL_PREFIX=~/DDS-Router/install -DCMAKE_PREFIX_PATH=~/DDS-Router/install cmake --build . --target install
-
cd ~/DDS-Router git clone https://github.com/eProsima/dev-utils.git mkdir dev-utils/build cd dev-util/build cmake ../cmake_utils -DCMAKE_INSTALL_PREFIX=~/DDS-Router/install -DCMAKE_PREFIX_PATH=~/DDS-Router/install cmake ../cpp_utils -DCMAKE_INSTALL_PREFIX=~/DDS-Router/install -DCMAKE_PREFIX_PATH=~/DDS-Router/install cmake --build . --target install
-
Once all dependencies are installed, install DDS Router:
cd ~/DDS-Router git clone https://github.com/eProsima/DDS-Router.git mkdir DDS-Router/build cd DDS-Router/build cmake ../ddsrouter_core -DCMAKE_INSTALL_PREFIX=~/DDS-Router/install -DCMAKE_PREFIX_PATH=~/DDS-Router/install cmake ../ddsrouter_yaml -DCMAKE_INSTALL_PREFIX=~/DDS-Router/install -DCMAKE_PREFIX_PATH=~/DDS-Router/install cmake ../tools/ddsrouter_tool -DCMAKE_INSTALL_PREFIX=~/DDS-Router/install -DCMAKE_PREFIX_PATH=~/DDS-Router/install cmake --build . --target install
Note
By default, DDS Router does not compile tests.
However, they can be activated by downloading and installing Gtest
and building with CMake option -DBUILD_TESTS=ON
.
1.3.2. Global installation¶
To install DDS Router system-wide instead of locally, remove all the flags that
appear in the configuration steps of Fast-CDR
, Fast-DDS
, and
DDS-Router
, and change the first in the configuration step of foonathan_memory_vendor
to the
following:
-DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
1.4. Run an application¶
To run the DDS Router application, source the Fast DDS library
and execute the executable file that has been installed in <install-path>/ddsrouter_tool/bin/ddsrouter
:
# If built has been done using colcon, all projects could be sourced as follows
source install/setup.bash
./<install-path>/ddsrouter_tool/bin/ddsrouter
Be sure that this executable has execute permissions.