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:
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
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>
directoryRun 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
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
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.
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
andADDRESS
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
Run the Messenger Example¶
While still in ssh on the Pi, enter the
OpenDDS-<version>
directoryexport 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"
For the C++ example:
cd $DDS_ROOT/DevGuideExamples/DCPS/Messenger
For the Java example:
cd $DDS_ROOT/java/tests/messenger
./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¶
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.
OpenSSL¶
In
$BUILD_ROOT
, download and extract the OpenSSL source archive, and change to that extracted directory. See OpenSSL 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
Xerces-C++¶
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)</pre></li>
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.mkdir build-pi cd build-pi
cmake -DCMAKE_TOOLCHAIN_FILE=$BUILD_ROOT/PiToolchain.cmake -DCMAKE_INSTALL_PREFIX=$BUILD_ROOT/pi-xerces ..
make
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
tobuild/target/lib
copy
$BUILD_ROOT/pi-xerces/lib/libxerces-c-3.2.so
tobuild/target/lib