Environment Setup: Linux
The guide below explains how the C++ environment for Universal Messaging can be set up for compiling and running the applications on a Linux® operating system.
Running a C++ application for use with Universal Messaging requires the system to know the location of certain runtime libraries. OpenSSL is assumed to be installed and the location known to the system. The POCO libraries and Nirvana.so are found in cplus/linux64/lib. To make these libraries known to the system, several methods can be used:
- By setting the
LD_LIBRARY_PATH environment variable:
export LD_LIBRARY_PATH= <InstallDir>/UniversalMessaging/cplus/linux/lib:$LD_LIBRARY_PATHThis will allow programs to be compiled and run in the current shell.
-
In order to make the libraries globally available you can copy the libraries into /usr/local/lib.
- Another method to make the
libraries globally available is by using ldconfig. This requires root access to
the system:
The above code first navigates the required directory. It then creates a new file called nirvana.conf (this can be any file name with extension ".conf") containing the location of the libraries. Once this file is created, ldconfig is run (must be run as root) which creates the necessary links.[root]$ cd /etc/ld.so.conf.d [root]$ echo <InstallDir>/UniversalMessaging/cplus/linux/lib>nirvana.conf [root]$ ldconfig
To compile a C++ application for use with Universal Messaging, the location of the shared libraries must be known by the system as described above. The compiler must also know the location of certain C++ headers. These headers are found in cplus/include. The cplus/examples directory contains sample applications written using the C++ API of Universal Messaging as well as the make files which can be used to compile them. In order to compile your own applications, please refer to these makefiles as a template. Each application comes pre-compiled, the executable (no file extension) can be found in the application's directory (cplus/examples/applicationName).
Compiling the Sample Applications
In order to make compilation easier, we have provided a CMake script which can be used to generate the build files for the target platform. CMake can be downloaded from http://www.cmake.org/cmake/resources/software.html.
In the following descriptions, "[AppName]" refers to the name of the application you want to compile. The source code of the sample applications is available at the location:
<InstallDir>/UniversalMessaging/cplus/examples/
Use the following commands at the console:
- cmake .
- cd [AppName]
- make
- export PATH=$PATH:[Location_Of_UM_Install]/cplus/lib/x86_64
- ./[AppName]