Raspberry Pi
Ensure that your host environment has:
- a C++ compiler
- GNU Make
- Perl
- If building with DDS Security: CMake
- Optional Java SDK 1.5 or later for Java binding support
- Download and extract the latest tar.gz file from the download site.
-
Download and extract the Linux GCC 10.2 cross-compiler toolchain from the ARM Developer website.
Rename the resulting directory from
gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf
tocross-pi-gcc
and move it to/opt
. - If building with DDS Security, follow the steps below to build OpenSSL and Xerces-C++ for the Pi.
- Enter the OpenDDS-<version> directory
-
Run the following as a single command.
Additional options:./configure --target=linux-cross --target-compiler=/opt/cross-pi-gcc/bin/arm-none-linux-gnueabihf-g++ (additional options)
- If using DDS Security:
Replace--security --no-tests --openssl=SSL_ROOT --xerces3=XERCESCROOT
SSL_ROOT
andXERCESCROOT
with the paths for your system (see below).
Note that the Google Test Framework is not supported in this configuration, therefore--no-tests
is required when using--security
. - If using Java bindings:
--java
- If using DDS Security:
make
For this guide you need a Raspberry Pi set up with Raspbian Bullseye Linux (the Lite variant works) and connected to a local network. You will also need a Linux host system (or virtual machine) connected to the same network where we will build OpenDDS. We have tested with Ubuntu 20.04.3 LTS x86_64 and CentOS Stream 8 x86_64. This guide assumes you know the address and user credentials of the Pi. Perform these all these steps on the host computer:
See Support if you encounter problems with configuration or building.
There are multiple ways to do this, including using a flash drive. We do not recommend copying the entire build tree, since it can be 2+ GB. The following steps copy the OpenDDS runtime libraries, support scripts, and test executables over the network.
- Leave the OpenDDS-<version> directory:
cd ..
tar czhf OpenDDS-<version>.tar.gz OpenDDS-<version>/build/target/ACE_wrappers/lib OpenDDS-<version>/build/target/lib OpenDDS-<version>/build/target/bin OpenDDS-<version>/build/target/ACE_wrappers/bin/PerlACE OpenDDS-<version>/build/target/DevGuideExamples/DCPS/Messenger
-
scp OpenDDS.tar.gz USER@ADDRESS:
where USER and ADDRESS are the username and IP address of your Raspberry Pi. It will ask you for the password for the user on the Pi. ssh USER@ADDRESS
to access the Pi, taking the same information as the previous command.tar xzf OpenDDSOpenDDS-<version>.tar.gz
- While still in ssh on the Pi, enter the OpenDDS-<version> directory
export DDS_ROOT="$PWD/build/target"
export ACE_ROOT="$DDS_ROOT/ACE_wrappers"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:"$ACE_ROOT/lib":"$DDS_ROOT/lib"
export PATH=${PATH}:"$ACE_ROOT/bin":"$DDS_ROOT/bin"
cd $DDS_ROOT/DevGuideExamples/DCPS/Messenger
for C++ example orcd $DDS_ROOT/java/tests/messenger
for Java example./run_test.pl
The Messenger Example starts an InfoRepo, publisher, and subscriber. The InfoRepo allows the publisher and subscriber to find each other. Once the publisher finds the subscriber, it sends 10 messages to the subscriber and waits 30 seconds for the subscriber to acknowledge the messages.
See Chapter 2 of the Developer's Guide for a detailed explanation of the Messenger C++ Example or Chapter 10 for the Java Example.
Building Third-Party Libraries
- Create and enter a directory to perform the build.
- Set the
BUILD_ROOT
shell variable to the working directory. - This will be the parent directory for the source repos and "staged" installation directories for the cross-compiled software.
- In
$BUILD_ROOT
, download and extract the OpenSSL source archive, and change to that extracted directory. See here for any version requirements for OpenSSL. ./Configure --cross-compile-prefix=/opt/cross-pi-gcc/bin/arm-none-linux-gnueabihf- linux-armv4
make
make install DESTDIR=$BUILD_ROOT/pi-openssl
- In
$BUILD_ROOT
, create the filePiToolchain.cmake
with the contents:set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_C_COMPILER /opt/cross-pi-gcc/bin/arm-none-linux-gnueabihf-gcc) set(CMAKE_CXX_COMPILER /opt/cross-pi-gcc/bin/arm-none-linux-gnueabihf-g++) set(CMAKE_FIND_ROOT_PATH /opt/cross-pi-gcc/arm-none-linux-gnueabihf) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(THREADS_PTHREAD_ARG 2)
- In
$BUILD_ROOT
, download and extract the Xerces-C++ source archive, and change to that extracted directory. See here for any version requirements for Xerces. mkdir build-pi; cd build-pi
cmake -DCMAKE_TOOLCHAIN_FILE=$BUILD_ROOT/PiToolchain.cmake -DCMAKE_INSTALL_PREFIX=$BUILD_ROOT/pi-xerces ..
make
make install
- For
configure
(see above)- SSL_ROOT is
$BUILD_ROOT/pi-openssl/usr/local
- XERCESCROOT is
$BUILD_ROOT/pi-xerces
- SSL_ROOT is
- For runtime loading of shared objects
- copy
$BUILD_ROOT/pi-openssl/usr/local/lib/libcrypto.so.1.1
tobuild/target/lib
- copy
$BUILD_ROOT/pi-xerces/lib/libxerces-c-3.2.so
tobuild/target/lib
- copy