Open acarophobicitch opened 5 months ago
This is how the linker is invoked from the CMake-generated Ninja build files:
arm-none-eabi-g++ -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections -O0 -g3 -DCLOCK_MONOTONIC=1 -fno-rtti -fno-exceptions -fno-threadsafe-statics -g -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -T "STM32F767ZITx_FLASH.ld" --specs=nano.specs -Wl,-Map=microros-cubemx-cmake.map -Wl,--gc-sections -Wl,--print-memory-usage $OBJECTS -o microros-cubemx-cmake.elf ../../install/lib/libint32_publisher.a ../../install/lib/librmw_microxrcedds.a ../../install/lib/librcutils.a ../../install/lib/librcutils.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librmw.a ../../install/lib/librcutils.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librcutils.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librmw.a ../../install/lib/librcutils.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librmw.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librcutils.a ../../install/lib/librosidl_typesupport_microxrcedds_c.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librclc.a ../../install/lib/librcl.a ../../install/lib/librcutils.a ../../install/lib/librcl_action.a ../../install/lib/librcl.a ../../install/lib/librcl_interfaces__rosidl_typesupport_introspection_c.a ../../install/lib/librcl_interfaces__rosidl_typesupport_c.a ../../install/lib/librcl_interfaces__rosidl_generator_c.a ../../install/lib/librcl_logging_interface.a ../../install/lib/librmw_microxrcedds.a ../../install/lib/librcutils.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librmw.a ../../install/lib/librcutils.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librmw.a ../../install/lib/librosidl_typesupport_microxrcedds_c.a ../../install/lib/librmw.a ../../install/lib/libaction_msgs__rosidl_typesupport_introspection_c.a ../../install/lib/libunique_identifier_msgs__rosidl_typesupport_introspection_c.a ../../install/lib/libaction_msgs__rosidl_typesupport_c.a ../../install/lib/libaction_msgs__rosidl_generator_c.a ../../install/lib/libunique_identifier_msgs__rosidl_typesupport_c.a ../../install/lib/libunique_identifier_msgs__rosidl_generator_c.a ../../install/lib/libstd_msgs__rosidl_typesupport_introspection_c.a ../../install/lib/libbuiltin_interfaces__rosidl_typesupport_introspection_c.a ../../install/lib/librosidl_typesupport_introspection_c.a ../../install/lib/libstd_msgs__rosidl_typesupport_c.a ../../install/lib/libstd_msgs__rosidl_generator_c.a ../../install/lib/libbuiltin_interfaces__rosidl_typesupport_c.a ../../install/lib/libbuiltin_interfaces__rosidl_generator_c.a ../../install/lib/librosidl_typesupport_c.a ../../install/lib/librosidl_runtime_c.a ../../install/lib/librcutils.a -lm -lc -lnosys
Describe the bug
I am trying to integrate MicroROS in an existing STM32CubeMX CMake project. Linking the final binary fails with errors about unresolved references in librmw_microxrcedds.a to symbols in Micro XRCE-DDS Client and to symbols in Micro XRCE-DDS typesupport:
Everything, including the main project, is a colcon package built with Ninja. The project layout is:
The default task in main.c initializes MicroROS, calls into application packages, which are built as static libraries, to initialize node(s) etc., and then calls
rclc_executor_spin_some()
in a loop.The project is built with
colcon build --packages-up-to cubemx-microros-cmake --packages-ignore-regex=".*_cpp" --metas ./colcon.meta --merge-install --paths . --base-paths ./MicroROS ./App --cmake-args -G Ninja --no-warn-unused-cli -DCMAKE_POSITION_INDEPENDENT_CODE=OFF -DTHIRDPARTY=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="$(pwd)/cmake/gcc-arm-none-eabi.cmake"
Relevant parts of CMakeLists.txt:
Application package(s):
Main CMakeLists.txt:
I also tried to make the top level project an
ament_cmake_ros
package usingament_target_dependencies()
, to no avail.Expected behavior:
Linking the binary works without errors, all required MicroROS libraries are passed to the linker in the correct order.
System information: