5. Mac OS installation from sources¶
5.1. Fast DDS library installation¶
This section describes the instructions for installing eProsima Fast DDS in a Mac OS 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.
The installation of eProsima Fast DDS in a MacOS environment from sources requires the following tools to be installed in the system:
XML validation tool [optional]
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)"
22.214.171.124. 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:
126.96.36.199. CMake, g++, pip3, wget and git¶
brew install cmake python3 wget
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. Also add the Gtest repository into the workspace directory.
git clone https://github.com/google/googletest src/googletest-distribution
188.8.131.52. 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.
eProsima Fast DDS has the following dependencies, when installed from binaries in a Linux environment:
184.108.40.206. 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 Homebrew:
brew install asio tinyxml2
5.1.3. Colcon installation¶
pip3 install -U colcon-common-extensions vcstool
Fast-DDSdirectory 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
Build the packages:
--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 colcon
220.127.116.11. Run an application¶
When running an instance of an application using eProsima Fast DDS, the colcon overlay built in the
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:
Add the sourcing of the colcon overlay permanently to the
PATH, by typing the following:
touch ~/.bash_profile echo 'source ~/Fast-DDS/install/setup.bash' >> ~/.bash_profile
5.1.4. CMake installation¶
18.104.22.168. Local installation¶
Fast-DDSdirectory where to download and build eProsima Fast DDS and its dependencies:
Clone the following dependencies and compile them using CMake.
cd ~/Fast-DDS git clone https://github.com/eProsima/foonathan_memory_vendor.git mkdir foonathan_memory_vendor/build cd foonathan_memory_vendor/build cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DBUILD_SHARED_LIBS=ON sudo cmake --build . --target install
cd ~/Fast-DDS git clone https://github.com/eProsima/Fast-CDR.git mkdir Fast-CDR/build cd Fast-CDR/build cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install sudo cmake --build . --target install
Once all dependencies are installed, install eProsima Fast DDS:
cd ~/Fast-DDS git clone https://github.com/eProsima/Fast-DDS.git mkdir Fast-DDS/build cd Fast-DDS/build cmake .. -DCMAKE_INSTALL_PREFIX=~/Fast-DDS/install -DCMAKE_PREFIX_PATH=~/Fast-DDS/install sudo cmake --build . --target install
By default, eProsima Fast DDS does not compile tests. However, they can be activated by downloading and installing Gtest.
22.214.171.124. Global installation¶
To install eProsima Fast DDS system-wide instead of locally, remove all the flags that
appear in the configuration steps of
Fast-DDS, and change the first in the
configuration step of
foonathan_memory_vendor to the following:
126.96.36.199. 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, which in the case of system-wide installation is:
/usr/local/lib/ (if local
installation is used, adjust for the correct directory).
There are two possibilities:
Prepare the environment locally by typing the command:
Add it permanently it to the
PATH, by typing:
touch ~/.bash_profile echo '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 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.
Fast DDS-Gen is built using Gradle. Gradle is an open-source build automation tool which requires a Java version to be executed (see Gradle-Java compatibility matrix).
Even though earlier versions of Gradle support Java 8, Fast DDS-Gen stopped supporting Java versions previous to Java 11 since release v2.4.0.
Fast DDS-Gen introduced support for Gradle 7 in release v2.2.0. Gradle 8 is not yet supported.
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 Gradle temporarily for the compilation step. Please, follow the steps below to build Fast DDS-Gen:
If Fast DDS has already been installed following Colcon installation, skip cloning Fast DDS-Gen’s
repository, as it can already be found under the
src directory within the colcon workspace.
cd ~ git clone --recursive https://github.com/eProsima/Fast-DDS-Gen.git cd Fast-DDS-Gen ./gradlew assemble
In case that a supported Gradle version is already installed in the system, Fast DDS-Gen can also be built running directly:
Fast-DDS-Gen folder contains the following packages:
share/fastddsgen, where the generated Java application is.
scripts, containing some user friendly scripts.
To make these scripts accessible from any shell session and directory, add the
scriptsfolder path to the
PATHenvironment variable using the method described above.