Raspberry Pi

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 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:

  1. Ensure that your host environment has:

    • a C++ compiler

    • GNU Make

    • Perl

    • CMake if building with DDS Security

    • Optional Java SDK 1.5 or later for Java binding support

  2. Download and extract the latest tar.gz file from the download site

  3. 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 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-none-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. 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.

  1. Leave the OpenDDS-<version> directory:

    cd ..
    
  2. 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
    
  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 OpenDDSOpenDDS-<version>.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. For the C++ example:

    cd $DDS_ROOT/DevGuideExamples/DCPS/Messenger
    

    For the Java example:

    cd $DDS_ROOT/java/tests/messenger
    
  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 Getting Started for a detailed explanation of the Messenger C++ Example or Java Bindings 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 source archive, and change to that extracted directory. See OpenSSL for any version requirements for OpenSSL.

  2. ./Configure --cross-compile-prefix=/opt/cross-pi-gcc/bin/arm-none-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-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)</pre></li>
    
  2. In $BUILD_ROOT, download and extract the Xerces-C++ source archive, and change to that extracted directory. See Xerces for any version requirements for Xerces.

  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