[ros-users] [Discourse.ros.org] [Release] Is it a good practice to force `RPATH` to be embedded in the installed targets?

Mani ros.discourse at gmail.com
Thu Feb 16 00:37:36 UTC 2017




For one of the packages I maintain ([parrot_arsdk](https://github.com/AutonomyLab/parrot_arsdk)), I modified the install rules to install all the libraries to a sub folder of ` ${CATKIN_PACKAGE_LIB_DESTINATION}` (i.e. ` ${CATKIN_PACKAGE_LIB_DESTINATION}/parrot_arsdk`). The rational behind this is to prevent some of the libraries that are custom built as part of the SDK (e.g. `curl` and `libressl`) to be picked up by other ROS packages by accident. 

When compiling a dependent package (e.g. [bebop_autonomy](https://github.com/AutonomyLab/bebop_autonomy)) from source everything is fine. The compiled binary is linked against the correct `parrot_arsdk` libraries (since `RPATH` is embedded in the files created in the `build/devel` space). However when `install` rules are applied, `RPATH` information are stripped from the binaries (this is the default behaviour), so unless `LD_LIBRARY_PATH` is manually set, it is not possible to execute those binaries from the `install` space.

[My workaround](https://github.com/AutonomyLab/bebop_autonomy/commit/aef8a5d7127a59298668343942cfbebc84ec5330#diff-ba723d57ee1ae13ecda9443f17d179d3R35) for this problem was to add the following line to `CMakeLists.txt` of the dependent package (`bebop_driver`):

```cmake
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
```
This fixes the issue on my local `catkin` workspace since the binaries installed into the `install` space now have full `RPATH` information embedded in them. However I am not sure if this is the best way to fix this issue and if this approach is going to work when the binaries are built on the build farm. Any comment or suggestion is really appreciated.

PS. This is to confirm that the `RPATH` information is indeed embedded in the installed targets:


    $ ldd catkin_ws/install/lib/libbebop.so  | grep ar
    libarcontroller.so => /full/path/to/catkin_ws/install/lib/parrot_arsdk/libarcontroller.so (0x00007fcfcd24f000)






---
[Visit Topic](https://discourse.ros.org/t/is-it-a-good-practice-to-force-rpath-to-be-embedded-in-the-installed-targets/1335/1) or reply to this email to respond.




More information about the ros-users mailing list