RPATH in installed executable
I am trying to make a ROS node that runs as setuid (I know, but it has to run as root).
When building from source using 'catkin_make' and then chmoding to 4755, everything works fine.
But when building a debian from that source, (and adding a postinst for chmoding to 4755), it fails to resolve any dynamic libraries.
This seems to be because the installed version of the executable doesn't include RPATH.
If I add it manually with sudo patchelf --force-rpath --set-rpath '/opt/ros/kinetic/lib/' /opt/ros/kinetic/lib/pi_sonar/pi_sonar
, everything works again.
How do I force the debians coming from the bloom generated gbp to embed the RPATH into the executable?
Output of readelf -d
on the catkin_make version
Tag Type Name/Value 0x00000001 (NEEDED) Shared library: [libtf2_ros.so] 0x00000001 (NEEDED) Shared library: [libactionlib.so] 0x00000001 (NEEDED) Shared library: [libtf2.so] 0x00000001 (NEEDED) Shared library: [libroscpp.so] 0x00000001 (NEEDED) Shared library: [librosconsole.so] 0x00000001 (NEEDED) Shared library: [libroscpp_serialization.so] 0x00000001 (NEEDED) Shared library: [librostime.so] 0x00000001 (NEEDED) Shared library: [libboost_system.so.1.58.0] 0x00000001 (NEEDED) Shared library: [libboost_thread.so.1.58.0] 0x00000001 (NEEDED) Shared library: [libpthread.so.0] 0x00000001 (NEEDED) Shared library: [libstdc++.so.6] 0x00000001 (NEEDED) Shared library: [libm.so.6] 0x00000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x00000001 (NEEDED) Shared library: [libc.so.6] 0x00000001 (NEEDED) Shared library: [ld-linux-armhf.so.3] 0x0000000f (RPATH) Library rpath: [/opt/ros/kinetic/lib:/usr/lib/arm-linux-gnueabihf/hdf5/openmpi/lib:/usr/lib/openmpi/lib:]
Output of readelf -d
on the debian version (notice no rpath).
Tag Type Name/Value 0x00000001 (NEEDED) Shared library: [libtf2_ros.so] 0x00000001 (NEEDED) Shared library: [libactionlib.so] 0x00000001 (NEEDED) Shared library: [libtf2.so] 0x00000001 (NEEDED) Shared library: [libroscpp.so] 0x00000001 (NEEDED) Shared library: [librosconsole.so] 0x00000001 (NEEDED) Shared library: [libroscpp_serialization.so] 0x00000001 (NEEDED) Shared library: [librostime.so] 0x00000001 (NEEDED) Shared library: [libboost_system.so.1.58.0] 0x00000001 (NEEDED) Shared library: [libboost_thread.so.1.58.0] 0x00000001 (NEEDED) Shared library: [libpthread.so.0] 0x00000001 (NEEDED) Shared library: [libstdc++.so.6] 0x00000001 (NEEDED) Shared library: [libm.so.6] 0x00000001 (NEEDED) Shared library: [libgcc_s.so.1] 0x00000001 (NEEDED) Shared library: [libc.so.6] 0x00000001 (NEEDED) Shared library: [ld-linux-armhf.so.3] 0x0000000c (INIT) 0x3b928