Debugging UT with GDB unable to find libcpptestruntime64.so
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
-
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 Nuckles0 -
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.
0 -
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.
0 -
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.
0