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

Missing ament_export_dependencies for spdlog for static ros2 builds #82

Closed
hannes09 opened this issue Nov 4, 2021 · 1 comment · Fixed by #89
Closed

Missing ament_export_dependencies for spdlog for static ros2 builds #82

hannes09 opened this issue Nov 4, 2021 · 1 comment · Fixed by #89

Comments

@hannes09
Copy link

hannes09 commented Nov 4, 2021

I tried to compile a static ROS2 stack with the folling options:

colcon build --packages-ignore rclcpp_components --symlink-install --cmake-args -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_SECURITY=OFF -DENABLE_SSL=NO -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DFORCE_BUILD_VENDOR_PKG=ON -DSPDLOG_BUILD_SHARED=OFF

Multipel packages can not be build because rcl_logging_spdlog is not exporting spdlog as a dependency.
I belive PR 60 has broken static builds.

Adding
ament_target_dependencies(${PROJECT_NAME} rcl_logging_interface rcpputils rcutils spdlog )

for static builds should solve the problems.

@sloretz
Copy link
Contributor

sloretz commented Jun 10, 2022

I was able to reproduce with

colcon build --packages-ignore rclcpp_components --symlink-install --cmake-args -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_SECURITY=OFF -DENABLE_SSL=NO -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DFORCE_BUILD_VENDOR_PKG=ON -DSPDLOG_BUILD_SHARED=OFF --packages-ignore-regex .*connext.* .*fastcdr.* .*fastrtps.* .*foonathan.* --packages-up-to-regex rclcpp.*
Starting >>> rcl
--- stderr: rcl                              
CMake Error at CMakeLists.txt:69 (add_library):
  Target "rcl" links to target "CycloneDDS::ddsc" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:69 (add_library):
  Target "rcl" links to target "iceoryx_binding_c::iceoryx_binding_c" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?


CMake Error at CMakeLists.txt:69 (add_library):
  Target "rcl" links to target "spdlog::spdlog" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?


CMake Generate step failed.  Build files cannot be regenerated correctly.

Reading https://cmake.org/pipermail/cmake/2016-May/063400.html I learned CMake links PRIVATE dependencies in downstream targets as if they were PUBLIC when building a static library.

Calling ament_export_dependencies(...) should fix it. Was ament_target_dependencies in the issue description a typo?

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 a pull request may close this issue.

2 participants