This is an automated email from the ASF dual-hosted git repository.

lupyuen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 7dbebe1673afc25228c3da82be9cfb7e3d10c5ec
Author: Arjav Patel <[email protected]>
AuthorDate: Sat May 23 08:29:50 2026 +0000

    apps/system/microros: add DIR-typedef NuttX guard patch.
    
    NuttX defines DIR as a struct type in dirent.h.  The rcutils filesystem
    source has a bare typedef int DIR that triggers a redefinition error when
    NuttX system headers are on the include path.  Guard it with #ifndef DIR
    so the typedef is skipped when the type is already defined.
    
    Applied automatically during the micro_ros_src/src fetch step with
      patch -p1 --forward --ignore-whitespace ... || true
    so the build is idempotent if the upstream ever merges a fix.
    
    Signed-off-by: Arjav Patel <[email protected]>
---
 .../patches/0001-dir-typedef-nuttx-guard.patch     | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/system/microros/patches/0001-dir-typedef-nuttx-guard.patch 
b/system/microros/patches/0001-dir-typedef-nuttx-guard.patch
new file mode 100644
index 000000000..75e4f91d9
--- /dev/null
+++ b/system/microros/patches/0001-dir-typedef-nuttx-guard.patch
@@ -0,0 +1,31 @@
+From: micro-ROS NuttX Port <[email protected]>
+Subject: [PATCH] rcutils: guard bare DIR typedef to avoid conflict with NuttX 
dirent.h
+
+NuttX defines DIR as a struct type in dirent.h.  The bare
+  typedef int DIR;
+in rcutils/src/filesystem.c causes a redefinition error when the
+NuttX system headers are on the include path.  Guard it so it is
+only emitted when DIR has not already been defined.
+
+--- a/rcutils/src/filesystem.c
++++ b/rcutils/src/filesystem.c
+@@ -1,6 +1,8 @@
+ // Copyright 2017 Open Source Robotics Foundation, Inc.
+ //
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // you may not use this file except in compliance with the License.
+ // You may obtain a copy of the License at
+ //
+ //     http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing, software
+ // distributed under the License is distributed on an "AS IS" BASIS,
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ // See the License for the specific language governing permissions and
+ // limitations under the License.
+
+ #if !defined _WIN32 && !defined __QNXTO__
++#ifndef DIR
+ typedef int DIR;
++#endif
+ #endif

Reply via email to