Debugging UT with GDB unable to find libcpptestruntime64.so

shew82shew82 Posts: 1

After following the Parasoft guide to debugging a test with GDB on 64-bit Ubuntu 18 (https://docs.parasoft.com/display/CPPDESKE1040/Exercise+15+-+Debugging+Unit+Tests+With+GDB), I'm having an issue where both GDB and Eclipse's built in debugging are not launching properly. In both situations it seems that there's an issue loading libcpptestruntime64.so.

Here's a picture of the GDB text, as launched through the Parasoft Debug test configuration:

If I try and run the UT executable directly from a terminal, I get the error:
"error while loading shared libraries: libcpptestruntime64.so: cannot open shared object file: No such file or directory" (....parasoft/cpptest/10.4 is on my PATH).

Launching the eclipse debug profile generates the same error:

Any ideas?

Thanks!
Shaun

Comments

  • brian_nucklesbrian_nuckles Posts: 26 admin
    edited January 2

    Hi Shaun,

    What compiler are you using for your application? Is this a GCC compiler and if so, is it a 32 or 64 bit compiler? If the GCC compiler is 32-bit, the 64-bit runtime will not automatically be included. That said, it should not normally be necessary but a workaround may be to add the library to the link step of your build directly using:

    -L/path/to/runtime/library -lcpptestruntime64

    The location that holds libcpptestruntime64.so should also be added to the LD_LIBRARY_PATH environment variable for it to be available to GDB at runtime.

    Hope this helps!
    Brian Nuckles

  • Andrey MadanAndrey Madan Posts: 268 ✭✭✭
    edited January 2

    @brian_nuckles :

    Thanks. Good suggestions. Note: In this case the application is being built by C/C+test. It works fine when launched directly from C/C++test GUI using Run Unit Test configuration. However, when we want to launch the executable outside of C/C++test by navigating to out scratchpad folder and executing .cpptest//unit_data/current_blah/testProject.exe from the command line - we get the SAME error as displayed on the second screenshot.

    Would we be able to execute the test application from C/C++test if the wrong compiler was used? Just curious.

  • brian_nucklesbrian_nuckles Posts: 26 admin

    What target/compiler is the application being built for within C++test? It may be the C++test is building the application with only 32-bit dependencies within C++Test while executing outside of the Eclipse and with GDB expects 64-bit libraries. The linker options shown above can be added to the C++Test build as in the following screenshot.

  • MirekMirek Posts: 92 ✭✭

    @Andrey Madan

    However, when we want to launch the executable outside of C/C++test by navigating to out scratchpad folder and executing cpptest//unit_data/current_blah/testProject.exe from the command line - we get the SAME error as displayed on the second screenshot.

    This is expected. The test executable is linked against the shared library with C++tst runtime. If you want to start the test executable outside of C++test, you need to modify LD_LIBRARY_PATH:

    export LD_LIBRARY_PATH=<c++test install dir>/engine/lib:$LD_LIBRARY_PATH

    and then try to execute the test executable.

    Let me know if it helps.

Sign In or Register to comment.