5. Mac OS installation from sources — Fast DDS 2.14.2 documentation (2024)

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

  • Fast DDS library installation

    • Requirements

    • Dependencies

    • Colcon installation

    • CMake installation

  • Fast DDS-Gen installation

    • Requirements

    • Compiling Fast DDS-Gen

5.1. Fast DDS library installation

This section describes the instructions for installing eProsima Fast DDS in a Mac OS environment fromsources. The following packages will be installed:

  • foonathan_memory_vendor, an STL compatible C++ memory allocatorlibrary.

  • fastdds_gen, a Java application that generates source code using the data types defined in an IDL file.

  • fastcdr, a C++ library that serializes according to thestandard 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.

5.1.1. Requirements

The installation of eProsima Fast DDS in a MacOS environment from sources requires the following tools to beinstalled in the system:

5.1.1.1. Homebrew

Homebrew is a macOS package manager, it is needed to install some of eProsima Fast DDS’s dependencies.To install it open a terminal window and run the following command.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

5.1.1.2. Xcode Command Line Tools

The Xcode command line tools package is separate from Xcode and allows for command line development in mac.The previous step should have installed Xcode CLI, to check the correct installation run the following command:

gcc --version

5.1.1.3. CMake, g++, pip3, wget and git

These packages provide the tools required to install eProsima Fast DDS and its dependencies from command line.Install CMake, pip3 and wget using the Homebrew package manager:

brew install cmake python3 wget

5.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 opportuneCMake configuration optionswhen calling colcon or CMake.For more details, please refer to the CMake options section.Also add the Gtest repository into the workspace directory.

git clone --branch release-1.11.0 https://github.com/google/googletest src/googletest-distribution

5.1.1.5. XML validation tool

XML validation is a new command introduced to validate the XML profiles against an XSD schema through Fast DDS CLI.That ensures the proper characterization of the entities using the xml profiles.

For more details, please refer to the xml section.

Install the xmlschema dependency to be able to use this optional tool.

5.1.2. Dependencies

eProsima Fast DDS has the following dependencies, when installed from binaries in a Linux environment:

  • Asio and TinyXML2 libraries

  • OpenSSL

See also

For further information about this Fast DDS version dependencies, as well as for the corresponding versions ofother related products, please refer to the Fast DDS Library dependenciessection.

5.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 consistentasynchronous model.TinyXML2 is a simple, small and efficient C++ XML parser.Install these libraries using Homebrew:

brew install asio tinyxml2

5.1.2.2. OpenSSL

OpenSSL is a robust toolkit for the TLS and SSL protocols and a general-purpose cryptography library.Install OpenSSL using Homebrew:

brew install openssl@1.1

5.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.

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

    pip3 install -U colcon-common-extensions vcstool
  2. Create a Fast-DDS directory and download the repos file that will be used to installeProsima Fast DDS and its dependencies:

    mkdir ~/Fast-DDScd ~/Fast-DDSwget https://raw.githubusercontent.com/eProsima/Fast-DDS/master/fastrtps.reposmkdir srcvcs import src < fastrtps.repos
  3. Build the packages:

    colcon build --packages-up-to fastrtps

Note

The --cmake-args option allows to pass the CMake configuration options to the colcon build command.In Mac OS the location of OpenSSL is not found automatically and therefore has to be passed explicitly:--cmake-args -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib.This is only required when building with Security.For more information on the specific syntax, please refer to the CMake specific arguments page of the colconmanual.

5.1.3.1. Run an application

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

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

    source ~/Fast-DDS/install/setup.bash
  • Add the sourcing of the colcon overlay permanently to the PATH, by typing the following:

    touch ~/.bash_profileecho 'source ~/Fast-DDS/install/setup.bash' >> ~/.bash_profile

5.1.4. CMake installation

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

5.1.4.1. Local installation

  1. 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-DDSgit clone https://github.com/eProsima/foonathan_memory_vendor.gitmkdir foonathan_memory_vendor/buildcd foonathan_memory_vendor/buildcmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DBUILD_SHARED_LIBS=ONsudo cmake --build . --target install
    • Fast CDR

      cd ~/Fast-DDSgit clone https://github.com/eProsima/Fast-CDR.gitmkdir Fast-CDR/buildcd Fast-CDR/buildcmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/installsudo cmake --build . --target install
  3. Once all dependencies are installed, install eProsima Fast DDS:

    cd ~/Fast-DDSgit clone https://github.com/eProsima/Fast-DDS.gitmkdir Fast-DDS/buildcd Fast-DDS/buildcmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DCMAKE_PREFIX_PATH=~/Fast-DDS/installsudo cmake --build . --target install

Note

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

5.1.4.2. Global installation

To install eProsima Fast DDS system-wide instead of locally, remove all the flags thatappear in the configuration steps of Fast-CDR and Fast-DDS, and change the first in theconfiguration step of foonathan_memory_vendor to the following:

-DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON

5.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 thepackages have been installed, which in the case of system-wide installation is: /usr/local/lib/ (if localinstallation is used, adjust for the correct directory).There are two possibilities:

  • Prepare the environment locally by typing the command:

    export LD_LIBRARY_PATH=/usr/local/lib/
  • Add it permanently it to the PATH, by typing:

    touch ~/.bash_profileecho 'export LD_LIBRARY_PATH=/usr/local/lib/' >> ~/.bash_profile

5.2. Fast DDS-Gen installation

This section provides the instructions for installing Fast DDS-Gen in a Mac OS environment fromsources.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, and toeProsima products compatibility for the compatibility matrix against Fast DDS versions.

5.2.1. Requirements

Fast DDS-Gen is built using Gradle.Gradle is an open-source build automation tool which requires a Java version to be executed (seeGradle-Java compatibility matrix).

Important

Even though earlier versions of Gradle support Java 8, Fast DDS-Gen stopped supporting Java versions previous toJava 11 since release v2.4.0.

Important

Fast DDS-Gen introduced support for Gradle 7 in release v2.2.0.Gradle 8 is not yet supported.

See also

For further information about Fast DDS-Gen product related versions, please refer to theLibrary dependencies section.

5.2.1.1. Java JDK

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

Note

Fast DDS-Gen supports Java versions from 11 to 19.

5.2.2. Compiling Fast DDS-Gen

In order to compile Fast DDS-Gen, an executable script is included in the repository which will download Gradletemporarily for the compilation step.Please, follow the steps below to build Fast DDS-Gen:

Note

If Fast DDS has already been installed following Colcon installation, skip cloning Fast DDS-Gen’srepository, as it can already be found under the src directory within the colcon workspace.

mkdir -p ~/Fast-DDS/srccd ~/Fast-DDS/srcgit clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git fastddsgencd fastddsgen./gradlew assemble

Note

In case that a supported Gradle version is already installed in the system, Fast DDS-Gen can also be built runningdirectly:

gradle assemble

5.2.2.1. Contents

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

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

  • scripts, containing some user friendly scripts.

    Note

    To make these scripts accessible from any shell session and directory, add the scripts folder path to thePATH environment variable using the method described above.

5. Mac OS installation from sources — Fast DDS 2.14.2 documentation (2024)
Top Articles
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5942

Rating: 4.2 / 5 (53 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.