Building Connext DDS Applications With Connext-Config

RTI is always working on ways to simplify the process of building RTI Connext® DDS applications. With that in mind, our connext-config tool is a great way of helping to maintain flexibility for developers who are involved in building these business-critical applications.

To trace the recent evolution of the process, building applications that use RTI Connext DDS would typically require being able to integrate our header files, compiler flags, and libraries into a build system that potentially has previously set parameters. For this reason, RTI has never recommended nor forced end users to use any specific build system, as each customer may have different needs and requirements.

To account for these unique requirements, RTI has in the past been providing either plain-old Makefile or Windows Visual Studio projects for all the shipped examples and applications. Internally, however, RTI has often relied heavily on complex Makefile-based systems to build RTI Connext DDS for numerous supported targets.

We've now added a new approach. Over the past few years, RTI has joined the growing industry trend of relying on the popular tool CMake to simplify our internal build system. As a natural consequence, all newly published code will make use of CMake as well.

The good news is that regardless of this internal shift toward CMake, it is also still easy to integrate RTI Connext DDS into any existing build system that does not rely on CMake. How easy? In general, Windows builds rely on Visual Studio for their C/C++/C# applications, so to integrate RTI Connext DDS into an existing project, you would merely need to manually modify the project's settings to add the various header search paths and libraries.

For all Unix builds — including embedded systems where you may need to cross-compile your product on a Unix machine — there are several options:

  • Using plain Makefile
  • Using CMake to generate platform-specific build scripts (e.g., Makefiles, XCode project files)
  • Using autoconf/automake (autotools)

When building an RTI Connext DDS-based application, the build system must be made aware of:

  • The preferred compiler and linker
  • The compiler flags to use for a particular target architecture
  • The linker flags
  • The name of the libraries to include in the final image

For the cases listed above, the build system can take advantage of connext-config, a small and highly useful tool that RTI makes available through our RTI Community projects at GitHub.

Connext-Config

The connext-config utility takes its inspiration from the popular helper program called 'pkg-config' to provide the correct command arguments to build a particular application that depends on an external package. 

For example, an autotool-based configure.sh script may invoke pkg-config during the generation of the project Makefile to retrieve the C compiler's command line flags to use for a particular library. So, when using the QT GUI library, you can use the following command:

$ pkg-config --cflags Qt5Gui


to retrieve the C flags; pkg-config will then print (to stdout):

-I/usr/include/x86_64-linux-gnu/qt5/QtGui

-I/usr/include/x86_64-linux-gnu/qt5

-I/usr/include/x86_64-linux-gnu/qt5/QtCore

-I/usr/include/x86_64-linux-gnu/qt5

Just append this output to the system $CFLAGS, and the compiler will locate the headers for the QT library.

Similar to pkg-config, connext-config is a helper application that, once given an architecture, can provide an extensive list of useful build information. Connext-config is just one of the many projects available through our RTI Community GitHub page. 

To install connext-config, you can either build it from source (follow the instructions in the GitHub project’s home page) or un-tar one of the existing released archive files directly on top of your RTI Connext DDS installation. Connext-config can be installed on top of any RTI Connext DDS version from 5.3.0 and up, and is available for Linux and Mac OS hosts (Windows is not supported, since autotools and Makefiles are not a popular way to build applications for Windows).

Connext-config behaves similarly to pkg-config, except that it takes as the main argument the RTI Connext DDS target architecture (instead of the package name). For example, to retrieve the C compiler flags for the target x64Linux4gcc7.3.0:

$ connext-config --cflags x64Linux4gcc7.3.0
-m64 -Wall  -DRTI_UNIX -DRTI_LINUX -DRTI_64BIT
-I/home/fabrizio/rti/rti_connext_dds-6.0.1/include
-I/home/fabrizio/rti/rti_connext_dds-6.0.1/include/ndds


What’s really handy is that if you don't remember exactly the name of the target you have installed, you can simply ask connext-config for it:

$ connext-config --list-installed
armv6vfphLinux3.xgcc4.7.2
x64Linux4gcc7.3.0
x64Darwin17clang9.0


The GitHub project also contains two examples you can follow when using autotools to build your application:

  • examples/autoconf-hello: same as the C example application you can find in your rti_workspace under examples/connext_dds/c/hello_builtin
  • examples/autoconf-hello-cpp: same as the C++ example application from the rti_workspace: examples/connext_dds/c++/hello_idl

Each example contains an m4 macro that can be included in your main configure.ac file, which contains the definition of several command-line arguments for the build system to specify the various required parameters, such as the location where RTI Connext DDS is installed or the target architecture. With this tool, you can produce distribution of your software (make dist) that has a configure.sh that knows how to deal with RTI Connext DDS:

$ ./configure.sh --help
...
  --enable-target              ...
  --with-rticonnextdds         ...
  --with-rticonnextdds-static  ...
  --with-connext-config        ...


For CMake-based projects, RTI now provides a set of CMake files (as part of the connext-examples repo in GitHub), including a FindRTIConnextDDS.cmake that performs similar operations as connext-config (such as locating and providing command-line arguments for the build tools. If you want to, you can still use connext-config together with CMake, even though this approach defeats the whole purpose of CMake, where you define the build settings, but not in terms of command-line arguments. We recommend reviewing the example under examples/cmake-requestreply for more on this capability. Happy coding!

About the author

rti-blog-author-fabrizio-bertocciFabrizio Bertocci is a principal engineer at RTI. He has been with RTI for over 12 years. During his tenure, he has contributed to several parts of the RTI Connext DDS core libraries and products. He is currently with RTI Research, exploring new solutions, technologies and applications for DDS. Before joining RTI, he worked with EDA company Mentor Graphics, embedded silicon vendor VLSI (now NXP), along with technology start-ups. Fabrizio holds a Computer Engineering degree from the University of Pisa (Italy).

 

Getting Started with Connext DDS

Connext® DDS is the world's leading implementation of the Data Distribution Service (DDS) standard for Real-Time Systems. Try a fully-functional version of Connext DDS for 30 days.


Free Trial