Error when profiling ROS2 with perf record
Hi everyone,
As stated in the title, I would like to do some profiling with perf tool, especially, using perf record
and generate a Flame Graph afterward (Flame graph link here for who is interested: http://www.brendangregg.com/flamegrap...).
However, I have run into an error while using perf record
(I am also new to perf). Firstly, I tried to run following command:
sudo perf record -g ros2 run cpp_pubsub talker
It gave me an error:
Workload failed: No such file or directory
Then, I tried another way by running directly executable file:
sudo perf recodr -g ./build/cpp_pubsub/talker
This time I had another error:
./talker: error while loading shared libraries: librcl_interfaces__rosidl_typesupport_cpp.so: cannot open shared object file: No such file or directory
After spending some times to figure it out and also search on google, I still cannot find the solution. The library file: librcl_interfaces__rosidl_typesupport_cpp.so
still can be found in directory /opt/ros/eloquent/lib. The talker runs fine without perf record
.
Any help, suggestion or hint is welcomed :).
Cheers!
sudo
will "sanatise" your environment, leading to things likeLD_LIBRARY_PATH
being reset. ROS (both 1 and 2) nodes need the environment to be correctly configured, or they won't be able to find libraries and other runtime artefacts they need (such as the interfaces typesupport library you see mentioned in the error).You could try with
sudo -E
, which carries the environment of the caller over into thesudo
session.