The original linker command invoked by your build system must be modified to include the additional library required by the code coverage instrumentation.

The CMake and Bazel integration packages by default compile the runtime library source code with compiler and flags used in your project and automatically add it to the linker command line.  

Custom build system integrations require build scripts modification. The following example shows how this is typically accomplished: 

Original linking command line:  

lxx -L app/lib app/source.o -lsomelib -o app.exe 

Coverage-enabled linking command line: 

lxx -L app/lib app/source.o somelib.lib <INSTALL_DIR>/runtime/lib/cpptest64 -o app.exe 

Check your build scripts and build system documentation for instructions on modifying linker rules. 

In typical scenarios, when a tested application is executed natively on Linux, the default pre-built runtime library, shipped with C/C++test CT distribution in <INSTALL_DIR>/runtime/lib/cpptest64.so, is appropriate.  

When collecting code coverage for embedded and cross-platform targets, you will need a dedicated runtime library compiled with your specific cross compiler, using options appropriate for your target system configuration. For more information, see Configuring and Building the Runtime Library.

  • No labels