nuttx-apps/system/microros/patches/0003-rcutils-strcasecmp-include-strings-h.patch
Arjav Patel 939ed0ca2a apps/system/microros: add rcutils strcasecmp strings.h include patch.
POSIX specifies strcasecmp/strncasecmp in <strings.h>, not <string.h>.
On NuttX (and other strict POSIX environments) rcutils/src/strcasecmp.c
only includes <string.h>, causing an implicit-declaration error for
strcasecmp when cross-compiling.

Patch 0003 adds #include <strings.h> guarded by !_WIN32, matching the
existing Windows/POSIX split in the file.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
2026-05-26 06:57:55 +08:00

19 lines
673 B
Diff

From: micro-ROS NuttX Port <noreply@nuttx.apache.org>
Subject: [PATCH] rcutils: include <strings.h> for strcasecmp on NuttX
POSIX specifies strcasecmp/strncasecmp in <strings.h>, not <string.h>.
NuttX follows the standard strictly so omitting this header causes an
"implicit declaration" error. Guard the include with __NuttX__ so it
only applies where needed and does not affect Linux or other platforms
that already expose strcasecmp through <string.h>.
--- a/rcutils/src/strcasecmp.c
+++ b/rcutils/src/strcasecmp.c
@@ -17,6 +17,9 @@ extern "C"
#include <errno.h>
#include <string.h>
+#ifdef __NuttX__
+#include <strings.h>
+#endif
#include "rcutils/strcasecmp.h"