system/microros: Fix toolchain attribute strip breaking libc inlines.

micro_ros_lib/toolchain.cmake.in initialised C and CXX flags with
-D'__attribute__(x)=' to silence GCC attributes the upstream ament
build is not aware of. The strip also removed __gnu_inline__ and
__always_inline__ from NuttX's libc string.h inlines, so each
micro-ROS translation unit emitted external definitions of strcmp,
strcpy, strlen and friends. Sim final link then failed with ~50
multiple-definition errors.

Drop the define from both flag init lines so the attributes survive
and the inlines collapse as intended.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
This commit is contained in:
Arjav Patel 2026-05-31 10:11:06 +05:30 committed by Xiang Xiao
parent fa46bdf9e8
commit 3d6ea0ccec

View file

@ -9,8 +9,8 @@ set(PLATFORM_NAME "nuttx")
set(CMAKE_C_COMPILER @CMAKE_C_COMPILER@)
set(CMAKE_CXX_COMPILER @CMAKE_CXX_COMPILER@)
set(CMAKE_C_FLAGS_INIT "-std=c11 @ARCH_C_FLAGS@ -D__NuttX__ -D'__attribute__(x)='" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_INIT "-std=c++14 @ARCH_CPP_FLAGS@ -fno-rtti -D__NuttX__ -D'__attribute__(x)='" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_INIT "-std=c11 @ARCH_C_FLAGS@ -D__NuttX__" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_INIT "-std=c++14 @ARCH_CPP_FLAGS@ -fno-rtti -D__NuttX__" CACHE STRING "" FORCE)
set(NUTTX_TOPDIR @NUTTX_TOPDIR@)
set(NUTTX_APPDIR @NUTTX_APPDIR@)