Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit specifying CMake flags to link with RPATH? #162

Closed
EricCousineau-TRI opened this issue Mar 23, 2019 · 2 comments
Closed

Permit specifying CMake flags to link with RPATH? #162

EricCousineau-TRI opened this issue Mar 23, 2019 · 2 comments
Labels
question Further information is requested

Comments

@EricCousineau-TRI
Copy link

EricCousineau-TRI commented Mar 23, 2019

May I ask if it's possible to force CMake to link with RPATHs?

Here's my current attempt:
https://github.com/EricCousineau-TRI/repro/blob/50b26e2/ros/ros2_bazel_prototype/NOTES.md

Some commentary:

  • I'm really confused by the RPATH behavior with some packages... If I build it with my janky "hermetic" setup, certain things always link to the libs (e.g. rclcpp, rcl, rcutils, std_msgs).
  • Even attempting to use the Kitware instructions for specifying RPATH in a build, I can't seem to make any difference...

Random editorial: TTBOMK, the ROS packaging philosophy is to strip the RPATHs to permit hot-swapping libs; however, I would still like to make C++ binaries fully specified without needing special environment variables, esp. relevant to usage with Bazel (relates ).

May tangentially relate ros2/ros2#457

BTW Please let me know if I'm using "RPATH" terminology incorrectly... I more-or-less just pattern match when I see this word + shell commands.

UPDATE: Posted an update in colcon/colcon-bazel#14 about using Bazel to resolve the paths, and some rmw stuff.

@dirk-thomas dirk-thomas added the question Further information is requested label Mar 25, 2019
@dirk-thomas
Copy link
Contributor

the ROS packaging philosophy is to strip the RPATHs to permit hot-swapping libs

That is not really a "ROS packaging philosophy" but standard CMake behavior.

I can't recommend anything more than "whatever CMake offers to customize the RPATH behavior". Maybe asking on answers.ros.org will yield more useful feedback to your questions since more people read it. If you do so please reference the question here for future readers to find it.

Also since the ticket isn't really an actionable items for this repo I will go ahead and close it. Please feel free to continue commenting.

@EricCousineau-TRI
Copy link
Author

Makes sense, thanks!

Also, realized what I did wrong here:

I'm really confused by the RPATH behavior with some packages...

It was because I wasn't using install. If I use the following steps, then everything is stripped as intended:

cd $(mktemp -d)
git clone https://github.com/ros2/examples -b 0.6.2
source /opt/ros/crystal/setup.bash 
mkdir -p tmp_ws/src
ln -sr examples/rclcpp/minimal_publisher tmp_ws/src/
cd tmp_ws/
colcon build
env LD_LIBRARY_PATH= ldd \
    ./install/examples_rclcpp_minimal_publisher/lib/examples_rclcpp_minimal_publisher/publisher_lambda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants