.. _section-compilation: Compilation =========== Linux, macOS, QNX, VxWorks, Lynx, Android ----------------------------------------- For these systems, *RTI Perftest* makes use of a script in the top-level directory named ``build.sh``. The purpose of ``build.sh`` is to first invoke *RTI DDS Generator* (*rtiddsgen*) to generate the type-code files and makefiles needed to compile a target architecture, then to execute the makefile with the right arguments to generate the executables. This script supports the code generation and compilation for *Traditional C++*, *Modern C++*, *C#*, and *Java*. Potentially, ``build.sh`` can generate and compile code for every architecture supported by *rtiddsgen* where a makefile is generated as output when the ``-example`` command-line is specified. .. _section-prerequisites: Prerequisites ~~~~~~~~~~~~~ For compiling *RTI Perftest*, there are a few prerequisites; if you downloaded the executables already compiled, you can skip these steps: - *RTI Connext DDS Professional* or *RTI Connext DDS Micro* should be installed in the system where the ``build.sh`` script is going to run. The target libraries for the platform to be generated should also be installed. .. - If you are building for the C# API implementation, the *RTI Connext DDS* dotnet package should be installed. .. - The ``$NDDSHOME`` environment variable should be set correctly. Or, pass ``$NDDSHOME`` directly to the ``build.sh`` script by using the ``--nddshome `` command-line option. When compiling for *RTI Connext DDS Micro*, the ``$RTIMEHOME`` environment variable should be set correctly. Or, pass ``$RTIMEHOME`` directly to the ``build.sh`` script by using the ``--rtimehome `` command-line option. .. - The ``build.sh`` script is written in ``bash``. It will execute from ``/bin/bash``. .. - ``GNU make`` is required to be accessible from the ``$PATH`` environment variable in order to execute the ``makefiles`` generated by *rtiddsgen*. Or, pass the ``GNU make`` executable directly to the ``build.sh`` script by using the ``--make `` command-line option. .. - When compiling for *RTI Connext DDS Micro*, ``Cmake`` is required to be accessible from the ``$PATH`` environment variable in order to execute the ``makefiles`` generated by *rtiddsgen*. Or, pass the ``cmake`` executable directly to the ``build.sh`` script by using the ``--cmake `` command-line option. .. - The C++ Compiler/Linker parent folders should be in the ``$PATH`` variable, or they should be specified as full path names (see :ref:`compilation-parameters-linux`). If unspecified, the names of the compiler and linker are going to be determined by the makefile generated by *rtiddsgen*. The C++ Compiler and Linker are not required if the script is set to avoid the C++ compilation by adding the ``--skip-cpp-build`` and ``--skip-cpp11-build`` command-line options. .. - Java JDK should be available in the system and accessible from the ``$PATH`` environment. This is not required if the script is set to avoid the Java ByteCode generation by adding the ``--skip-java-build`` command-line option. .. - If you intend to compile statically using *RTI Security Plugins*, you will need to link against the OpenSSL/wolfSSL libraries for your architecture. .. - If compiling for *RTI Connext TSS*, make sure that the *TSS* libraries have been compiled for the GeneralPurpose FACE profile, since that is the profile that has been tested with *Perftest*. *Perftest* does not currently support *RTI Connext TSS* built with the SafetyBase profile. Before building *Perftest* for *RTI Connext TSS*, the following environment variables also have to be set: - ``RTITSSHOME``: absolute path to an *RTI Connext TSS* installation. - ``NDDSHOME``: absolute path to an *RTI Connext Pro* installation. Only needed when compiling for *RTI Connext TSS* over *RTI Connext Pro*. - ``NDDSARCH`` (optional): architecture of the *RTI Connext Pro* libraries to use. It should only be used when it is not the same as the architecture of the *RTI Connext TSS* libraries. - ``RTIMEHOME``: absolute path to an *RTI Connext Micro* installation. Only needed when compiling for *RTI Connext TSS* over *RTI Connext Micro*. - ``RTIMEARCH`` (optional): architecture of the *RTI Connext Micro* libraries to use. It should only be used when it is not the same as the architecture of the *RTI Connext TSS* libraries. .. _compilation-parameters-linux: Parameters ~~~~~~~~~~ The ``build.sh`` script accepts the following list of parameters: .. list-table:: Build Script Parameters :name: TableBuildLinuxParameters :widths: 10 30 60 :header-rows: 1 * - Parameter - Required - Description * - ``--platform`` - Required - Architecture/platform for which ``build.sh`` is going to compile *RTI Perftest* * - ``--micro`` - Optional - Compile *RTI Perftest* against *RTI Connext DDS Micro* * - ``--micro-24x-compatibility`` - Optional - Compile *RTI Perftest* against *RTI Connext DDS Micro* 2.4.11 and above. * - ``--tss`` - Optional - Compile *RTI Perftest* against *RTI Connext TSS 3.1.2* over *RTI Connext Pro 6.1.1.4* or *RTI Connext Micro 2.4.13.4*. * - ``--nddshome`` - Optional - Path to the *RTI Connext DDS Professional* installation. If this parameter is not present, the ``$NDDSHOME`` variable should be. * - ``--rtimehome`` - Optional - Path to the *RTI Connext DDS Micro* installation. If this is not present, the ``$RTIMEHOME`` variable should be set. * - ``--skip-java-build`` - Optional - Avoid ``Java ByteCode`` generation and ``.jar`` creation. Not available when compiling for *RTI Connext DDS Micro*. * - ``--skip-cpp-build`` - Optional - Avoid C++ code generation and compilation. * - ``--skip-cpp11-build`` - Optional - Avoid C++ New PSM code generation and compilation. Not available when compiling for *RTI Connext DDS Micro*. * - ``--java-build`` - Optional - Only ``Java ByteCode`` generation and ``.jar`` creation. Not available when compiling for *RTI Connext DDS Micro* * - ``--cpp-build`` - Optional - Only C++ code generation and compilation * - ``--cpp11-build`` - Optional - Only C++ New PSM code generation and compilation. Not available when compiling for *RTI Connext DDS Micro*. * - ``--cs-build`` - Optional - Only C# code generation and compilation. Not available when compiling for *RTI Connext DDS Micro*. * - ``--dynamic`` - Optional - Compile using the RTI Connext DDS dynamic libraries. Default: Static Libraries. Not available when compiling for *RTI Connext DDS Micro*. * - ``--debug`` - Optional - Compile using the RTI Connext DDS debug libraries. Default: Release Libraries. * - ``--customType`` - Optional - Use the Custom type feature with your type. See details and examples of use in :ref:`section-using_custom_types`. * - ``--customTypeFlatData`` - Optional - Use the Custom type feature with your FlatData type. See details and examples of use in :ref:`section-using_custom_types`. * - ``--flatData-max-size `` - Optional - Specify the maximum size in bytes of the sample to be sent when using FlatData language binding. Default: 10485760 * - ``--no-zeroCopy`` - Optional - Avoid adding the libraries and flags for Zero-Copy. This might be needed if the compilation fails due to missing libraries (`nddsmetpz`). Default: Not enabled. * - ``--secure`` - Optional - Enable the compilation of the Perfest code specific for security and adds the *RTI Connext DDS Security Plugins* Libraries in the linking step (if compiling statically). Default: Not set. * - ``--security`` - Optional - Same as ``--secure``. * - ``--lightWeightSecure`` - Optional - Enable the compilation of the Perfest code specific for security and adds the *RTI Connext DDS LightWeight Security Plugins* Libraries in the linking step (if compiling statically). Default: Not set. * - ``--lightWeightSecurity`` - Optional - Same as ``--lightWeightSecure``. * - ``--openssl-home`` - Optional - Path to the OpenSSL home directory. Needed when compiling using the ``--secure`` option and statically. * - ``--wolfssl-home`` - Optional - Path to the wolfSSL home directory. Needed when compiling using the ``--secure`` option and statically. * - ``--ssl-home`` - Optional - Path to the SSL home directory. Needed when compiling using the ``--secure`` option and statically. * - ``--ssl-version`` - Optional - Provide a partial name to the *openSSL* or *WolfSSL* version you want to use. E.g. ``--ssl-version openssl-1.1``. Default: Not set. * - ``--openssl-version`` - Optional - Same as ``--ssl-version``. * - ``--wolfssl-version`` - Optional - Same as ``--ssl-version``. * - ``--make`` - Optional - Path to the ``GNU make``executable. If this parameter is not present, the ``GNU make`` variable should be available from your ``$PATH`` variable. * - ``--cmake`` - Optional - Path to the ``cmake`` executable. If this parameter is not present, the ``cmake`` variable should be available from your ``$PATH`` variable. * - ``--add-cmake-args`` - Optional - Additional arguments that will be passed directly to the ``cmake`` executable. * - ``--compiler`` - Optional - Path to (or name of) the compiler executable. If this parameter is not a full path, the named executable should be available from your ``$PATH`` variable. (NOTE: C++/C++11 builds only) * - ``--linker`` - Optional - Path to (or name of) the linker executable. If this parameter is not a full path, the named executable should be available from your ``$PATH`` variable. (NOTE: C++/C++11 builds only) * - ``--perl`` - Optional - Path to ``PERL`` executable. If this parameter is not present, not present, the path to PERL should be available from your ``$PATH`` variable. * - ``--java-home`` - Optional - Path to the Java ``JDK`` home folder. If this parameter is not present, ``javac``, ``jar`` and ``java`` executables should be available from your ``$PATH`` variable. * - ``--ns-resolution`` - Optional - Try to use the system real-time clock to get nanosecond resolution. Availability depends on the OS. For the Traditional C++ implementation only. Default: not enabled. * - ``--osx-shmem-shmmax`` - Optional - Specify the maximum segment size for shared memory in OSX. Default: 400MB. * - ``--clean`` - Optional - If this option is present, the ``build.sh`` script will clean all the generated code and binaries from previous executions. * - ``--build-doc`` - Optional - Generate the HTML and PDF documentation. This parameter is only available on ``build.sh``. * - ``--help -h`` - Optional - If this option is present, the ``build.sh`` script will display a help description and exit .. _section-linux_compilation_examples: Examples Running Build Script ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To build using ``build.sh``, simply invoke the script with the command-line parameters desired. The following are some typical examples: - Generation and compilation for a given architecture (``x64Darwin15clang7.0``) for C++ (traditional and modern) and Java . .. code-block:: console ./build.sh --platform x64Darwin15clang7.0 - Generation and compilation for a given architecture (``x64Darwin15clang7.0``) just for C++ (traditional and modern). .. code-block:: console ./build.sh --platform x64Darwin15clang7.0 --skip-java-build - Generation and compilation for a single given architecture (``x64Darwin15clang7.0``) just for Java. .. code-block:: console ./build.sh --platform x64Darwin15clang7.0 --java-build - Generation and compilation just for C# (no architecture required). .. code-block:: console ./build.sh --cs-build - Generation and compilation for a given architecture (``x64Darwin15clang7.0``) for all supported languages, plus linking against the dynamic and debug libraries. .. code-block:: console ./build.sh --platform x64Darwin15clang7.0 --dynamic --debug - Generation and compilation for a given architecture (``x64Darwin15clang7.0``) for all supported languages, enabling the security options and linking statically (default). .. code-block:: console ./build.sh --platform x64Darwin15clang7.0 --secure --openssl-home - Generation and compilation for a given architecture (``x64Darwin15clang7.0``) for all supported languages, enabling the security options and linking dynamically. As you can see in this case, there is no need to specify the ``--openssl-home`` command-line argument. .. code-block:: console ./build.sh --platform x64Darwin15clang7.0 --secure --dynamic - Generation and compilation for a given architecture (``x64Linux4gcc7.3.0``) for all supported languages, modifying the default maximum size of a *Perftest* type sample to 100MB (104857600B) when using the *RTI FlatDataâ„¢ language binding*. .. code-block:: console ./build.sh --platform x64Linux4gcc7.3.0 --flatData-max-size 104857600 - Generation and cross-compilation for a non-native architecture (``armv8Linux4.4gcc5.4.0``). Note how you can specify the compiler/linker used by *rtiddsgen*. .. code-block:: console ./build.sh --platform armv8Linux4.4gcc5.4.0 --compiler aarch64-linux-gnu-g++ --linker aarch64-linux-gnu-g++ - Generation and compilation for a given architecture (``x64Darwin14clang6.0``) compiling against *Connext DDS Micro*. .. code-block:: console ./build.sh --platform x64Darwin14clang6.0 --micro - Generation and compilation for *RTI Connext TSS* over *RTI Connext Pro* for a given architecture in debug mode. .. code-block:: console ./build.sh --platform x64Linux4gcc7.3.0FACE_GP --debug --tss .. note:: Before building *Perftest* for *RTI Connext TSS* over *RTI Connext Pro*, some environment variables have to be set. Check :ref:`section-prerequisites` to know more. - Generation and compilation for *RTI Connext TSS* over *RTI Connext Micro* for a given architecture in release mode. .. code-block:: console ./build.sh --platform x64Linux4gcc7.3.0FACE_GP --tss --micro .. note:: Before building *Perftest* for *RTI Connext TSS* over *RTI Connext Micro*, some environment variables have to be set. Check :ref:`section-prerequisites` to know more. - *RTI Perftest* directory clean-up. .. code-block:: console ./build.sh --clean Build script execution for *VxWorks* kernel mode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After building the *RTI Perftest* executables for *VxWorks* kernel mode, an extra step is needed: *munching.* *Munching* is automatically done in *Connext DDS Professional* starting in 6.0.0. However, for previous versions and for *Connext DDS Micro*, the process has to be done manually. Windows Systems --------------- For Windows systems, *RTI Perftest* makes use of a script in the top-level directory named ``build.bat``. Its content is equivalent to the ``build.sh`` script described before. The purpose of ``build.bat`` is to invoke *Code Generator* (*rtiddsgen*) in order to generate the type-code files and *Visual Studio* solution needed to compile a target architecture. You must then execute the *Visual Studio* solution with the right arguments to generate the executables. The ``build.bat`` script supports code generation and compilation for traditional C++, modern C++, C#, and Java. The ``build.bat`` script should be able to generate and compile code for every Windows architecture supported by *rtiddsgen* when the ``-example`` command line is specified. Windows Prerequisites ~~~~~~~~~~~~~~~~~~~~~ - *Connext DDS* should be installed in the system where the ``build.bat`` script is going to run. The target libraries for the platform to be generated should also be installed. .. - If you are building for the C# API implementation, the *Connext DDS* dotnet package should be installed. .. - The ``%NDDSHOME%`` environment variable should be set correctly. Alternatively, ``%NDDSHOME%`` can be passed directly to the ``build.bat`` script by using the ``--nddshome `` command-line option. When compiling for *Connext DDS Micro*, the ``%RTIMEHOME%`` environment variable should be set correctly. Alternatively, ``%RTIMEHOME%`` can be passed directly to the ``build.bat`` script by using the ``--rtimehome `` command-line option. .. - The *Visual Studio* for the architecture intended to be built should be installed in your system. The ``msbuild.exe`` program should be available in the ``%PATH%`` variable. .. note:: The simplest way to run the ``build.bat`` script and ensure that all the *Visual Studio* variables are correctly set is by running it from the *Visual Studio* command prompt provided by each of the *Visual Studio* versions. .. - When compiling for *Connext DDS Micro*, Cmake is required to be accessible from the ``%PATH%`` environment variable in order to execute the ``makefiles`` generated by *rtiddsgen*. Alternatively, the Cmake executable can be passed directly to the ``build.bat`` script by using the ``--cmake `` command-line option. .. - Java JDK should be available in the system and accessible from the ``%PATH%`` environment. This is not required if the ``build.bat`` script is set to avoid the Java ByteCode generation by adding the ``--skip-java-build`` command-line option. .. - If you intend to compile and test using *RTI Security Plugins*, link against the OpenSSL libraries for your architecture. Windows Parameters ~~~~~~~~~~~~~~~~~~ The ``build.bat`` script accepts the following list of parameters: .. list-table:: Build Script Parameters :name: TableBuildWindowsParameters :widths: 10 30 60 :header-rows: 1 * - Parameter - Required - Description * - ``--platform`` - Required - Architecture/platform for which ``build.bat`` is going to compile *RTI Perftest* * - ``--micro`` - Optional - Compile *RTI Perftest* against *RTI Connext DDS Micro* * - ``--micro-24x-compatibility`` - Optional - Compile *RTI Perftest* against *RTI Connext DDS Micro* 2.4.11 and above. * - ``--tss`` - Optional - Compile *RTI Perftest* against *RTI Connext TSS 3.1.2* over *RTI Connext Pro 6.1.1.4* or *RTI Connext Micro 2.4.13.4*. * - ``--nddshome`` - Optional - Path to the *RTI Connext DDS Professional* installation. If this parameter is not present, the ``%NDDSHOME%`` variable should be. * - ``--rtimehome`` - Optional - Path to the *RTI Connext DDS Micro* installation. If this is not present, the ``$RTIMEHOME`` variable should be set. * - ``--skip-java-build`` - Optional - Avoid ``Java ByteCode`` generation and ``.jar`` creation. Not available when compiling for *RTI Connext DDS Micro*. * - ``--skip-cpp-build`` - Optional - Avoid C++ code generation and compilation. * - ``--skip-cpp11-build`` - Optional - Avoid C++ New PSM code generation and compilation. Not available when compiling for *RTI Connext DDS Micro*. * - ``--java-build`` - Optional - Only ``Java ByteCode`` generation and ``.jar`` creation. Not available when compiling for *RTI Connext DDS Micro* * - ``--cpp-build`` - Optional - Only C++ code generation and compilation * - ``--cpp11-build`` - Optional - Only C++ New PSM code generation and compilation. Not available when compiling for *RTI Connext DDS Micro*. * - ``--cs-build`` - Optional - Only C# code generation and compilation. Not available when compiling for *RTI Connext DDS Micro*. * - ``--dynamic`` - Optional - Compile using the RTI Connext DDS dynamic libraries. Default: Static Libraries. Not available when compiling for *RTI Connext DDS Micro*. * - ``--debug`` - Optional - Compile using the RTI Connext DDS debug libraries. Default: Release Libraries. * - ``--customType`` - Optional - Use the Custom type feature with your type. See details and examples of use in :ref:`section-using_custom_types`. * - ``--customTypeFlatData`` - Optional - Use the Custom type feature with your FlatData type. See details and examples of use in :ref:`section-using_custom_types`. * - ``--flatData-max-size `` - Optional - Specify the maximum size in bytes of the sample to be sent when using FlatData language binding. Default: 10485760 * - ``--no-zeroCopy`` - Optional - Avoid adding the libraries and flags for Zero-Copy. This might be needed if the compilation fails due to missing libraries (`nddsmetpz`). Default: Not enabled. * - ``--secure`` - Optional - Enable the compilation of the Perfest code specific for security and adds the *RTI Connext DDS Security Plugins* Libraries in the linking step (if compiling statically). Default: Not set. * - ``--security`` - Optional - Same as ``--secure``. * - ``--lightWeightSecure`` - Optional - Enable the compilation of the Perfest code specific for security and adds the *RTI Connext DDS LightWeight Security Plugins* Libraries in the linking step (if compiling statically). Default: Not set. * - ``--lightWeightSecurity`` - Optional - Same as ``--lightWeightSecure``. * - ``--openssl-home`` - Optional - Path to the OpenSSL home directory. Needed when compiling using the ``--secure`` option and statically. * - ``--openssl-version`` - Optional - Same as ``--ssl-version``. * - ``--make`` - Optional - Path to the ``GNU make``executable. If this parameter is not present, the ``GNU make`` variable should be available from your ``$PATH`` variable. * - ``--cmake`` - Optional - Path to the ``cmake`` executable. If this parameter is not present, the ``cmake`` variable should be available from your ``$PATH`` variable. * - ``--add-cmake-args`` - Optional - Additional arguments that will be passed directly to the ``cmake`` executable. * - ``--perl`` - Optional - Path to ``PERL`` executable. If this parameter is not present, not present, the path to PERL should be available from your ``$PATH`` variable. * - ``--java-home`` - Optional - Path to the Java ``JDK`` home folder. If this parameter is not present, ``javac``, ``jar`` and ``java`` executables should be available from your ``$PATH`` variable. * - ``--clean`` - Optional - If this option is present, the ``build.bat`` script will clean all the generated code and binaries from previous executions. * - ``--build-doc`` - Optional - Generate the HTML and PDF documentation. This parameter is only available on ``build.sh``. * - ``--help -h`` - Optional - If this option is present, the ``build.bat`` script will display a help description and exit Examples running build script on Windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To build using ``build.bat``, simply invoke the script with the command-line parameters desired. The following are some typical examples: - Simple generation and compilation for a given architecture (``x64Win64VS2012``) for C++ (traditional and modern), C#, and Java. .. code-block:: console build.bat --platform x64Win64VS2012 - Simple generation and compilation for a given architecture (``x64Win64VS2012``) just for C#. .. code-block:: console build.bat --platform x64Win64VS2012 --cs-build Alternatively, this can be achieved by using: .. code-block:: console build.bat --platform x64Win64VS2012 --skip-java-build --skip-cpp-build --skip-cpp11-build - Generation and compilation for a given architecture (``x64Win64VS2012``) for all supported languages, plus linking against the dynamic and debug libraries. .. code-block:: console ./build.bat --platform x64Win64VS2012 --dynamic --debug - Generation and compilation for a given architecture (``x64Win64VS2012``) for all supported languages, enabling the security options and linking statically (default). .. code-block:: console ./build.bat --platform x64Win64VS2012 --secure --openssl-home - Generation and compilation for a given architecture (``x64Win64VS2012``) for all supported languages, enabling the security options and linking dynamically. As you can see in this case, there is no need to specify the ``--openssl-home`` command-line argument. .. code-block:: console ./build.bat --platform x64Win64VS2012 --secure --dynamic - Generation and compilation for a given architecture (``x64Win64VS2012``) for all supported languages, modifiying the default maximum size of a *Perftest* type sample to 100MB (104857600B) when using FlatData language binding. .. code-block:: console ./build.bat -platform x64Win64VS2012 --flatData-max-size 104857600 - Generation and compilation for a given architecture (``x64Win64VS2012``) for *Connext DDS Micro*, specifying the ``%RTIMEHOME%`` path. .. code-block:: console ./build.bat --platform x64Win64VS2012 --micro --rtimehome - Generation and compilation for a given architecture (``x64Win64VS2012``) for *Connext DDS Micro* with security, using debug mode and specifying the ``%RTIMEHOME%`` path. .. code-block:: console ./build.bat --platform x64Win64VS2012 --micro --rtimehome --secure --openssl-home - *RTI Perftest* directory clean-up. .. code-block:: console build.bat --clean