Bridging Qt to DDS

Qt Company has been publishing an Automation blog series on the various protocols that can bring Qt applications into the world of IoT. Of interest to me, they published a blog demonstrating Qt applications publishing and subscribing sensor data. I’d like to expand on this example, having done prior work integrating Qt and DDS. I’ve forked the GitHub project, and will document the various changes I make. Beginning with the basics: getting the project compiled and running.

The release linked here should succesfully compile and run in Ubuntu 16.04 LTS. By convention, all DDS libraries / headers are located in a path relative to the NDDSHOME environment variable. As such, the qmake project files were edited to accomodate the various path and filename changes.

RTIDDS_VERSION = x64Linux3gcc5.4.0

The library names also required some editing. Note that the library names end with a ’d’ suffix, indicating we’re linking to the shared, debug libraries. This is an area for potential improvement in future iterations.

LIBS += -L$${RTIDDS_PREFIX}/lib/$${RTIDDS_VERSION} -lnddscd -lnddscppd -lnddscored

In Linux we require several definitions to keep the compiler happy. That last one must be swapped out in order to build a 32 bit binary, but as I’m running this on a modern desktop I’m not too worried about it.


The original example was running the latest Qt release (5.11), while I’m back a few releases in stability land with Qt 5.9 LTS. To get the application running I cranked down the version numbers on several of the imports.

import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2

One last item requiring change: the commands for generating IDL sources caused make to fail. As an example, the original line looked like:

ddsplugingen.commands = echo "Additional Source(Plugin): ${QMAKE_FILE_NAME}"

The ( ) around Plugin caused /bin/sh to exit, requiring us to either escape or remove the offending characters.

ddsplugingen.commands = echo "Additional Source Plugin: ${QMAKE_FILE_NAME}"

With these minor changes, the examples succesfully compile and run in Ubuntu 16.04 LTS! Having established a baseline for development, we can move onto more exciting changes in future blog posts.