The goal of this guide is help you download and compile OpenDDS for Linux on the Raspberry Pi and run a simple example.
Build Directions

    For this guide you need a Raspberry Pi set up with Raspbian Stretch 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 18.04 x86_64 and RHEL/CentOS 7 x86_64. This guide assumes you know the address and user credentials of the Pi. Perform these all these steps on the host computer:

  1. Ensure that your host environment has:

    • a C++ compiler
    • GNU Make
    • Perl
    • If building with DDS Security: CMake
    • Optional Java SDK 1.5 through 1.8 for Java binding support
  2. Download and extract the latest tar.gz file from the download site.
  3. Download and extract the Raspberry Pi GCC 8.2 toolchain. Rename the resulting directory from cross-pi-gcc-8.2.0 to cross-pi-gcc and move it to /opt.
  4. If building with DDS Security, follow the steps below to build OpenSSL and Xerces-C++ for the Pi.
  5. Enter the OpenDDS-<version> directory
  6. Run the following as a single command.
    ./configure --target=linux-cross --target-compiler=/opt/cross-pi-gcc/bin/arm-linux-gnueabihf-g++ (additional options)
    Additional options:
    • If using DDS Security:
      --security --no-tests --openssl=SSL_ROOT --xerces3=XERCESCROOT
      Replace SSL_ROOT and XERCESCROOT 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
  7. make

See Support if you encounter problems with configuration or building.

Copying OpenDDS to the Pi

There are multiple ways to do this, including using a flash drive. This method uses the network.

  1. Leave the OpenDDS-<version> directory: cd ..
  2. tar czf OpenDDS.tar.gz OpenDDS-<version>
  3. 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.
  4. ssh USER@ADDRESS to access the Pi, taking the same information as the previous command.
  5. tar xzf OpenDDS.tar.gz
Run the Messenger Example
  1. While still in ssh on the Pi, enter the OpenDDS-<version> directory
  2. export DDS_ROOT="$PWD/build/target"
  3. export ACE_ROOT="$DDS_ROOT/ACE_wrappers"
  4. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:"$ACE_ROOT/lib":"$DDS_ROOT/lib"
  5. export PATH=${PATH}:"$ACE_ROOT/bin":"$DDS_ROOT/bin"
  6. cd $DDS_ROOT/DevGuideExamples/DCPS/Messenger for C++ example or cd $DDS_ROOT/java/tests/messenger for Java example
  7. ./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.

Next Steps

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

Setup
  1. Create and enter a directory to perform the build.
  2. Set the BUILD_ROOT shell variable to the working directory.
  3. This will be the parent directory for the source repos and "staged" installation directories for the cross-compiled software.
OpenSSL
  1. In BUILD_ROOT, download and extract the OpenSSL 1.1.1a source archive, and change to that extracted directory.
  2. ./Configure --cross-compile-prefix=/opt/cross-pi-gcc/bin/arm-linux-gnueabihf- linux-armv4
  3. make
  4. make install DESTDIR=$BUILD_ROOT/pi-openssl
Xerces-C++
  1. In BUILD_ROOT, create the file PiToolchain.cmake with the contents:
    set(CMAKE_SYSTEM_NAME Linux)
    set(CMAKE_SYSTEM_PROCESSOR arm)
    set(CMAKE_C_COMPILER /opt/cross-pi-gcc/bin/arm-linux-gnueabihf-gcc)
    set(CMAKE_CXX_COMPILER /opt/cross-pi-gcc/bin/arm-linux-gnueabihf-g++)
    set(CMAKE_FIND_ROOT_PATH /opt/cross-pi-gcc/arm-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)
  2. In BUILD_ROOT, download and extract the Xerces-C++ 3.2.2 source archive, and change to that extracted directory.
  3. mkdir build-pi; cd build-pi
  4. cmake -DCMAKE_TOOLCHAIN_FILE=$BUILD_ROOT/PiToolchain.cmake -DCMAKE_INSTALL_PREFIX=$BUILD_ROOT/pi-xerces ..
  5. make
  6. make install
Using these with OpenDDS
  • For configure (see above)
    • SSL_ROOT is $BUILD_ROOT/pi-openssl/usr/local
    • XERCESCROOT is $BUILD_ROOT/pi-xerces
  • For runtime loading of shared objects
    • copy $BUILD_ROOT/pi-openssl/usr/local/lib/libcrypto.so.1.1 to build/target/lib
    • copy $BUILD_ROOT/pi-xerces/lib/libxerces-c-3.2.so to build/target/lib