Robotics StackExchange | Archived questions

libxmlrpcpp not found

Hi guys,

I'm trying to run a package with root privileges for the executable. I followed the steps as per the ROS answers page #q165246.

and set the setuid bit to run with root permissions. But when I try to run the package I get an error as follows :

$ rosrun master_test master_test_node
~/catkin_ws/devel/lib/master_test/master_test_node: error while loading shared libraries: libxmlrpcpp.so: cannot open shared object file: No such file or directory 

I'm using ros melodic in my Ubuntu 18.04 machine.

I also tried checking my $PATH variable (/opt/ros/melodic/bin:) and $LD_LIBRARY_PATH (/opt/ros/melodic/lib) and both have been set correctly.

I'm not sure as to why the libxmlrpcpp.so file in the /opt/ros/melodic/lib location doesn't get linked with my catkin_ws/devel/lib/package_name folder.

Any help with rectifying the issue is appreciated.

Asked by manuaatitya on 2020-04-08 12:26:26 UTC

Comments

Answers

sudo apt install libxmlrpcpp-dev

Asked by sojin on 2020-11-10 11:24:12 UTC

Comments

Please explain why the -dev pkg is necessary. The library appears to be standard in ros_comm, and the user seems to imply they are having a run-time issue, not a build issue.

Asked by Mike Scheutzow on 2021-10-28 06:13:48 UTC

In my case sourcing the Ros distro's setup.bash helped. I am guessing that you need to source after you change to the root user. If you are using sudo your can also use sudo -E to preserve the environment.

The default sourcing command for linux (using bash) and your distro is:

sudo su # change to root user even if root doesn't have a password
source /opt/ros/melodic/setup.bash

In my case I simply forgot to source the environment. There were no elevated nodes involved. As I cannot test your case specifically I will describe what solved it for me. I have tested this on Noetic (my own distro). The linking went fine, but the classloader was unable to find and load the shared library (libxmlrpcpp.so). That's the same error as in your case. The other answer suggests installing the libxmlrpcpp-dev package. This will install it to a location already on your path (for all users). It didn't fully solve my problem, because more libraries are missing.

Asked by pvl on 2021-10-28 01:43:33 UTC

Comments

@manuaatitya The link you reference warns you that environment variable LD_LIBRARY_PATH is going to get cleared, so it's no surprise that the ros libraries can not be found at run-time. @pvl provides one workaround, and a comment at the link provides another.

Asked by Mike Scheutzow on 2021-10-28 06:25:06 UTC