Force rclcpp_lifecycle to be a shared lib#589
Open
spinningthelock wants to merge 1 commit into
Open
Conversation
ac3226d to
35f537d
Compare
Owner
|
Any chance this can be solved with a patch? |
Contributor
Author
|
@mvukov Its not going to be a trivial change. We have to revert back-ported fix ros2/rclcpp#2183 and then apply the original fix ros2/rclcpp#1756 assuming it will apply cleanly and work as intended. |
35f537d to
c21edfe
Compare
rclcpp_lifecycle contains an global variable that is accessed by some plugins and libraries. We want the plugin and libraries that uses the rclcpp_lifecycle to have the same global variable rather than the plugin which loads the .so and library that will staticly link.
c21edfe to
2a4363c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR forces rclcpp_lifecycle to link as a shared library.
rclcpp_lifecycle contains an global variable that is indirectly used by plugins and libraries. We want the plugin and libraries that uses the rclcpp_lifecycle to have the same global variable. Current statically linking behavior will result in plugin having its own global variable (its a .so) and library/node that loads the plugin having its own global variable. This fixes this issue by forcing rclcpp_lifecycle to link as a shared library. The Dynamic Linker ensures that only one instance of the library’s global data is mapped into the process memory. Now the both plugin and library/node will load rclcpp_lifecycle.so and will result in a single global variable. End result is that rclcpp_lifecycle node in the main binary can control the lifecycle of plugin and node itself.
This PR is needed as ROS2_Control package controls its loaded ros2_plugins lifecycle from the main node. Without this PR, ros2_control_node will crash on runtime as it expects loaded ros2 plugins lifecycle be present in the global variable. In addition, dynamic loading of rclcpp_lifecycle is the default cmake ros2 behavior.