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

Mani ros.discourse at gmail.com
Wed Mar 1 19:52:26 UTC 2017




Thanks @Martin_Guenther, @de-vri-es and @tfoote for your comments and suggestions. I came up with a solution based on an `env`-based wrapper script that works with both `rosrun` and within `launch` files. I could not get @tfoote's suggestion of using the `<machine>` tag to work on a local machine. I second @Martin_Guenther's [point](https://discourse.ros.org/t/is-it-a-good-practice-to-force-rpath-to-be-embedded-in-the-installed-targets/1335/6?u=mani) about this suggestion. 

Here is the wrapper script I wrote:

https://github.com/AutonomyLab/bebop_autonomy/blob/adynathos-indigo-devel/bebop_driver/scripts/bebop_env_loader

It simply looks at `LD_LIBRARY_PATH` environmental variable. If it is set, it picks the first element, adds `parrot_arsdk` to the end of that element and adds the modified element to the head of `LD_LIBRARY_PATH`. Then it executes any specified binary and arguments with the `env` command using the modified `LD_LIBRARY_PATH`.

For example if `LD_LIBRARY_PATH` is set to `/opt/ros/kinetic/lib:...`, it executes the following command:

```bash
$ env LD_LIBRARY_PATH=/opt/ros/kinetic/lib/parrot_arsdk:/opt/ros/kinetic/lib:... /path/to/binary [args]
```

This way it can be used both by `rosrun` and within launch files in a quite portable way:

```bash
$ rosrun --prefix "rosrun bebop_driver bebop_env_loader" bebop_driver bebop_driver_node
```

or 

```xml
<node pkg="bebop_driver" name="bebop_driver" type="bebop_driver_node" launch-prefix="$(find bebop_driver)/scripts/bebop_env_loader">
```

I did some testing and it seems to be working fine. Is this the solution you were suggesting?






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




More information about the ros-users mailing list