-
Notifications
You must be signed in to change notification settings - Fork 577
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
Fix MoveIt Servo compilation on macOS #555
Conversation
Codecov Report
@@ Coverage Diff @@
## main #555 +/- ##
==========================================
+ Coverage 46.71% 46.73% +0.02%
==========================================
Files 184 184
Lines 19686 19686
==========================================
+ Hits 9195 9198 +3
+ Misses 10491 10488 -3
Continue to review full report at Codecov.
|
add_library(${POSE_TRACKING} SHARED src/pose_tracking.cpp src/servo_parameters.cpp) | ||
ament_target_dependencies(${POSE_TRACKING} ${THIS_PACKAGE_INCLUDE_DEPENDS}) | ||
target_link_libraries(${POSE_TRACKING} ${SERVO_LIB_NAME}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should link it against the already built library rather than adding the source files to the target
add_library(${POSE_TRACKING} SHARED src/pose_tracking.cpp src/servo_parameters.cpp) | |
ament_target_dependencies(${POSE_TRACKING} ${THIS_PACKAGE_INCLUDE_DEPENDS}) | |
target_link_libraries(${POSE_TRACKING} ${SERVO_LIB_NAME}) | |
add_library(${POSE_TRACKING} SHARED src/pose_tracking.cpp) | |
ament_target_dependencies(${POSE_TRACKING} ${THIS_PACKAGE_INCLUDE_DEPENDS}) | |
target_link_libraries(${POSE_TRACKING} ${SERVO_LIB_NAME} ${SERVO_PARAM_LIB_NAME}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't link against the already-built library, because as you can see from the failing CI, this is a template issue -- the already-built library doesn't have the correct templated classes built in, which is why linker fails. Thus, the source has to be built each time (which is what my change does) to allow for any additional template classes that need to be built.
If this isn't okay, I think including the implementation (cpp) in the .h file would also work; that's the pattern I've seen for template classes in the past, at least. Let me know what you want to see.
Failing CI of this change: https://github.com/nkalupahana/ros2-foxy-macos/runs/3058543555?check_suite_focus=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think including the implementation (cpp) in the .h file would also work; that's the pattern I've seen for template classes in the past, at least. Let me know what you want to see.
Yes, I think this should be the solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, so it looks like you can't just include the .cpp file because not everything in there is templated so if you include it, then you'll get duplicate symbols. To fix that, I just moved the template function into the .h file (the forward declaration is already in there, so I figured that wouldn't be too big of a deal). Let me know if this works!
CI: https://github.com/nkalupahana/ros2-foxy-macos/actions/runs/1027725851
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to recommend the rationale for this be added as a comment to this CMake file... just copy-paste your explanation here, into the code :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added! :)
This reverts commit afa8c8d.
// Must be declared here to ensure template class is built for required templates when included | ||
template <typename T> | ||
void declareOrGetParam(T& output_value, const std::string& param_name, const rclcpp::Node::SharedPtr& node, | ||
const rclcpp::Logger& logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the default value parameter .?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, not sure. I'll fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think this is good.
moveit_ros/moveit_servo/include/moveit_servo/servo_parameters.h
Outdated
Show resolved
Hide resolved
Co-authored-by: Jafar Abdi <[email protected]>
@JafarAbdi any idea what's going on with CI? I don't think that failure is due to this PR. |
Look like the build farm is broken for rolling, I'll retrigger the workflow after few hours to see if it got fixed |
@JafarAbdi looks like a slightly different CI issue, has this been reported elsewhere? I didn't see any issues for it on ros2_control. |
@JafarAbdi rolling CI passed on 42ba2fa, but now it's broken again? Not sure what's going on. If it's okay with you, I think we should just merge this in -- rolling CI has now passed, and these breaks in the CI now have nothing to do with the PR :) |
@tylerjw agrees we can merge this because rolling is broken... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not change the functionality and will be part of the code I'll be replacing with my parameters refactor. I'll merge this without rolling-testing passing (it is a ros infrastructure problem).
* Update CMakeLists.txt * Revert "Update CMakeLists.txt" This reverts commit afa8c8d. * move template function to .h * re-added default_value * Update moveit_ros/moveit_servo/include/moveit_servo/servo_parameters.h Co-authored-by: Jafar Abdi <[email protected]> * rerun CI * rerun CI * rerun CI * rerun CI * added note about duplicate symbols Co-authored-by: Jafar Abdi <[email protected]> Co-authored-by: Tyler Weaver <[email protected]>
* Update CMakeLists.txt * Revert "Update CMakeLists.txt" This reverts commit afa8c8d. * move template function to .h * re-added default_value * Update moveit_ros/moveit_servo/include/moveit_servo/servo_parameters.h Co-authored-by: Jafar Abdi <[email protected]> * rerun CI * rerun CI * rerun CI * rerun CI * added note about duplicate symbols Co-authored-by: Jafar Abdi <[email protected]> Co-authored-by: Tyler Weaver <[email protected]>
Description
This PR fixes MoveIt Servo compilation on macOS. Closes #491
Broken CI: https://github.com/nkalupahana/ros2-foxy-macos/runs/3026534213?check_suite_focus=true
Now working: https://github.com/nkalupahana/ros2-foxy-macos/runs/3053981174?check_suite_focus=true
Checklist