You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2026/06/01 16:15:32 UTC
(nuttx-apps) 01/04: system/microros: Fix toolchain attribute strip breaking libc inlines.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 3d6ea0ccece3a1ccd917940b16bb1ff6a5ae3f5e
Author: Arjav Patel <ar...@gmail.com>
AuthorDate: Sun May 31 10:11:06 2026 +0530
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 <ar...@gmail.com>
---
system/microros/micro_ros_lib/toolchain.cmake.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/system/microros/micro_ros_lib/toolchain.cmake.in b/system/microros/micro_ros_lib/toolchain.cmake.in
index 8d3aabe3c..ebfa15eea 100644
--- a/system/microros/micro_ros_lib/toolchain.cmake.in
+++ b/system/microros/micro_ros_lib/toolchain.cmake.in
@@ -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@)