kurisaW / micro_ros_rtthread_component

1 stars 0 forks source link

[foxy] 问题汇总 #3

Open kurisaW opened 11 months ago

kurisaW commented 11 months ago
kurisaW commented 11 months ago

在linux下运行,出现报错:

image

根据报错:CMake试图查找名为"ament_cmake"的包的配置文件未找到 尝试解决:新建一个cmake_tools.sh脚本,脚本内容为:

export CMAKE_PREFIX_PATH=/tmp/micro/dev/src/ament_cmake:$CMAKE_PREFIX_PATH

尝试导入环境变量后仍然报错: image

kurisaW commented 11 months ago

在下载MCU 相关软件包后,可以发现作者加载了补丁文件到软件包中,分析这部分补丁可能存在版本问题:

image

明天重点分析下这块,可以借鉴吴晗大佬的仓库看看他对应的补丁内容

kurisaW commented 11 months ago

分析应该是ament_cmake.patch这个补丁文件没有成功应用进去

kurisaW commented 11 months ago

之前使用的conemu编译,其内部使用的是python27,使用python38后报错:

C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/time.c:16:8: error: redefinition of 'struct timespec'
 struct timespec{
        ^
In file included from d:\hightec-tricore\toolchains\tricore\v4.9.3.0-infineon-1.0\tricore\include\time.h:29:0,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/time.c:3:
d:\hightec-tricore\toolchains\tricore\v4.9.3.0-infineon-1.0\tricore\include\sys\types.h:114:8: note: originally defined here
 struct timespec {
        ^
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/time.c: In function 'uxr_nanos':
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/time.c:66:5: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
     clock_gettime(CLOCK_REALTIME, &ts);
     ^
make.exe[2]: *** [CMakeFiles/microxrcedds_client.dir/src/c/util/time.c.obj] Error 1
make.exe[2]: *** Waiting for unfinished jobs....
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/ping.c: In function 'uxr_acknack_pong':
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/ping.c:174:5: warning: missing braces around initializer [-Wmissing-braces]
     };
     ^
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/ping.c:174:5: warning: (near initialization for 'fake_session.info') [-Wmissing-braces]
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/ping.c:174:5: warning: missing initializer for field 'streams' of 'uxrSession' [-Wmissing-field-initializers]
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/src/c/util/ping.c:5:0:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/Micro-XRCE-DDS-Client/include/uxr/client/core/session/session.h:177:22: note: 'streams' declared here
     uxrStreamStorage streams;
                      ^
make.exe[1]: *** [CMakeFiles/microxrcedds_client.dir/all] Error 2
make.exe: *** [all] Error 2
---
Failed   <<< microxrcedds_client [5.33s, exited with code 2]
Aborted  <<< tinydir_vendor [21.5s]
WNDPROC return value cannot be converted to LRESULT
TypeError: WPARAM is simple, so must be an int object (got NoneType)

Summary: 12 packages finished [22.6s]
  1 package failed: microxrcedds_client
  1 package aborted: tinydir_vendor
  13 packages had stderr output: microcdr microxrcedds_client rmw_implementation_cmake rosidl_adapter rosidl_cmake rosidl_parser rosidl_typesupport_interface test_interface_files tinydir_vendor tracetools tracetools_launch tracetools_read tracetools_trace
  44 packages not processed
Build mcu micro-ROS environment failed

报错分析:电脑里装了Mingw,并且加入到用户变量中,与cmake指定的工具链起了冲突

kurisaW commented 11 months ago

由于我们使用的是arm-gcc-none-eabi工具链,在timer.c中已有关于结构体timespec的定义,此处的补丁文件中有关timespec结构体无需定义,如果使用其他的工具链但是没有此结构体的定义的话,需要打上补丁文件

image

kurisaW commented 10 months ago

继续编译,在rcutils软件包编译报错:

image

找到仓库源码,可以发现此处说明了 time_unix.c 不用于win系统,所以接下来想要修复这个问题应该将该文件取消编译并使用time_win32.c进行编译

https://github.com/kurisaW/rcutils/blob/c1a387d218b002829ef2fb9aa25fdd452629f9f1/src/time_unix.c#L16C33-L16C34

kurisaW commented 10 months ago

由于系统无法识别到WIN32,所以在 rcutils中指定了WIN32,同时系统需要使用到 #include ,通过安装windows 11 SDK后应该是避免这这个错误,还需审查

借鉴资料:

修改软件包指定WIN32:

修改后出现如下错误:

In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:82:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
   82 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:84:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rcutils_get_zero_initialized_allocator'
   84 | rcutils_get_zero_initialized_allocator(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:23,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:98:1: error: expected ';' before '_Bool'
   98 | bool
      | ^~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:120:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
  120 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:122:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rcutils_get_default_allocator'
  122 | rcutils_get_default_allocator(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:23,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:132:1: error: expected ';' before '_Bool'
  132 | bool
      | ^~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:156:1: error: expected ';' before 'void'
  156 | void *
      | ^~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:38,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:20:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/snprintf.h:56:1: error: expected ';' before 'int'
   56 | int
      | ^~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/snprintf.h:63:1: error: expected ';' before 'int'
   63 | int
      | ^~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:23,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:35:1: error: expected ';' before '_Bool'
   35 | bool
      | ^~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:71:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
   71 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:39,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:20:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:73:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rcutils_fault_injection_get_count'
   73 | rcutils_fault_injection_get_count(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:82:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
   82 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:39,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:20:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:84:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_rcutils_fault_injection_maybe_fail'
   84 | _rcutils_fault_injection_maybe_fail(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:153:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
  153 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:20:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:155:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rcutils_initialize_error_handling_thread_local_storage'
  155 | rcutils_initialize_error_handling_thread_local_storage(rcutils_allocator_t allocator);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:23,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:268:1: error: expected ';' before '_Bool'
  268 | bool
      | ^~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:20:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:282:1: error: expected ';' before 'const'
  282 | const rcutils_error_state_t *
      | ^~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:18:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:296:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
  296 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/allocator.c:20:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:298:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rcutils_get_error_string'
  298 | rcutils_get_error_string(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:82:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
   82 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:84:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rcutils_get_zero_initialized_allocator'
   84 | rcutils_get_zero_initialized_allocator(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:23,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:98:1: error: expected ';' before '_Bool'
   98 | bool
      | ^~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:120:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
  120 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:122:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rcutils_get_default_allocator'
  122 | rcutils_get_default_allocator(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:23,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:132:1: error: expected ';' before '_Bool'
  132 | bool
      | ^~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:156:1: error: expected ';' before 'void'
  156 | void *
      | ^~~~
make.exe[2]: *** [CMakeFiles/rcutils.dir/src/allocator.c.obj] Error 1
make.exe[2]: *** Waiting for unfinished jobs....
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:38,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:23:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/snprintf.h:56:1: error: expected ';' before 'int'
   56 | int
      | ^~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/snprintf.h:63:1: error: expected ';' before 'int'
   63 | int
      | ^~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:23,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:35:1: error: expected ';' before '_Bool'
   35 | bool
      | ^~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:71:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
   71 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:39,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:23:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:73:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rcutils_fault_injection_get_count'
   73 | rcutils_fault_injection_get_count(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:82:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
   82 | RCUTILS_WARN_UNUSED
      | ^~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:39,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:23:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/testing/fault_injection.h:84:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_rcutils_fault_injection_maybe_fail'
   84 | _rcutils_fault_injection_maybe_fail(void);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/allocator.h:26,
                 from C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/src/array_list.c:22:
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/macros.h:28:29: error: unknown type name '_Check_return_'
   28 | #define RCUTILS_WARN_UNUSED _Check_return_
      |                             ^~~~~~~~~~~~~~
C:/Users/RTT/AppData/Local/Temp/micro/mcu/src/rcutils/include/rcutils/error_handling.h:153:1: note: in expansion of macro 'RCUTILS_WARN_UNUSED'
  153 | RCUTILS_WARN_UNUSED
...

分析:由于rcutils中关于_Checkreturn 的定义是Microsoft Visual C++编译器的扩展,而我们所使用的工具链是arm-gcc

kurisaW commented 10 months ago

修改上一评论问题:

1.将toolchain.cmake文件中目标平台改为Gennetic 2.重新编译后遇到如下错误

image

尝试解决,使用

// src/time_unix.c
#elif defined(_POSIX_MONOTONIC_CLOCK)
#include <time.h>

// CMakeLists.txt
  add_definitions(-D__rtems__)
  add_definitions(-D_POSIX_MONOTONIC_CLOCK)

标识工具链

kurisaW commented 10 months ago

在windows10编译完成后发现报错如下:

OSError: [WinError 17] 系统无法将文件移到不同的磁盘驱动器。: 'libmicroros.a' -> 'D:\\Desktop\\Github_ws\\rt-thread\\bsp\\stm32\\stm32f407-rt-spark\\packages\\micro_ros_rtthread_component\\builder\\libmicroros\\
libmicroros.a'

image

windows11可以避免此问题