Skip to content

Conversation

@nkalupahana
Copy link
Contributor

@nkalupahana nkalupahana commented Jun 14, 2021

Description

This pull request fixes various compilation issues on macOS, allowing nearly all of Moveit2 to be compiled on macOS. This build has been verified on CI for macOS 10.15: https://github.com/nkalupahana/ros2-foxy-macos/runs/2815266613?check_suite_focus=true

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES LINK_FLAGS "${OpenMP_CXX_FLAGS}")
if(APPLE)
target_link_libraries(${MOVEIT_LIB_NAME} OpenMP::OpenMP_CXX)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try setting OpenMP with ament_target_dependencies?

Copy link
Contributor Author

@nkalupahana nkalupahana Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, using ament_target_dependencies(${MOVEIT_LIB_NAME} OpenMP) leads to a linker error. https://github.com/nkalupahana/ros2-foxy-macos/runs/2841920686?check_suite_focus=true

target_link_libraries seems to be necessary. Is that okay?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henningkayser ament_target_dependencies and target_link_libraries do two different things. ament_target_dependencies adds those dependencies to the list that gets set in the export target, where-as target_link_libraries configures linking. In this case we might need both, I'm not sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tylerjw ament_target_dependencies calls target_link_libraries internally and also configures include directories and other compile definitions. A well configured package should always work with ament_target_dependencies if the variables follow conventions. See https://github.com/ament/ament_cmake/blob/master/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake#L21

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fine if OpenMP doesn't work here, though

set(GLUT_LIBS GLUT::GLUT)
endif()
set(perception_GL_INCLUDE_DIRS "mesh_filter/include" "depth_image_octomap_updater/include")
set(SYSTEM_GL_INCLUDE_DIRS ${GLEW_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If using ament_target_dependencies doesn't work, I'd suggest adding a SYSTEM_GL_LIBRARIES variable like this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, did that!

@nkalupahana
Copy link
Contributor Author

@henningkayser fixes are in, please approve the workflows when you get the chance :)

@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #498 (76cbad4) into main (b3c4485) will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #498      +/-   ##
==========================================
- Coverage   45.25%   45.23%   -0.01%     
==========================================
  Files         169      169              
  Lines       18723    18723              
==========================================
- Hits         8471     8468       -3     
- Misses      10252    10255       +3     
Impacted Files Coverage Δ
...dl_kinematics_plugin/src/kdl_kinematics_plugin.cpp 74.72% <0.00%> (-1.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3c4485...76cbad4. Read the comment docs.

@nkalupahana
Copy link
Contributor Author

@henningkayser can we get this merged in? I've addressed the concerns from your review where possible.

@tylerjw
Copy link
Member

tylerjw commented Jun 28, 2021

I approved and started running the CI workflows for this. Would you mind rebasing this on main so we can get it merged (assuming CI passes)?

@nkalupahana
Copy link
Contributor Author

@tylerjw done! You'll have to re-approve the CI, though.

@henningkayser
Copy link
Member

@tylerjw please wait for #505 to get merged before merging this, it's always a lot of work to update the sync

@henningkayser henningkayser merged commit 4a210bc into moveit:main Jun 28, 2021
@nkalupahana nkalupahana deleted the patch-1 branch June 28, 2021 23:02
henningkayser pushed a commit to henningkayser/moveit2 that referenced this pull request Jun 29, 2021
* Fixed location of GLUT,GLEW framework on macOS
* Use explicit boost namespace for bind placeholders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants