Closed etherswangel closed 3 weeks ago
I think you need (make sure to change CHANGE_TARGET_HERE
):
if(APPLE)
set_target_properties(CHANGE_TARGET_HERE PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif()
This doesn't help. Here's my CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(cpp_pubsub)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}")
set(LINK_FLAGS "${LINK_FLAGS} -undefined dynamic_lookup")
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
add_executable(talker src/publisher_member_function.cpp)
ament_target_dependencies(talker rclcpp std_msgs)
add_executable(listener src/subscriber_member_function.cpp)
ament_target_dependencies(listener rclcpp std_msgs)
set_target_properties(talker listener PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
install(TARGETS
talker
listener
DESTINATION lib/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
Can you please try changing the LINK_FLAGS to -flto -Wl,-export_dynamic
?
I've tried to replicate this locally, and failed. I noticed that you do not have the compilers
package and other recommended build tools (see Installation tools for local development under https://robostack.github.io/GettingStarted.html) installed. Please install those and try again.
Feel free to reopen if the problem persists.
Solution to issue cannot be found in the documentation.
Issue
I'm running the
cpp_pubsub
tutorial but encounteredfor some packages it might be
My build command is
but some warnings were raised
I added the following to CMakeLists.txt but with no help
Installed packages
Environment info