micro-ROS / micro_ros_arduino

micro-ROS library for Arduino
Apache License 2.0
435 stars 112 forks source link

Cannot compile micro_ros_arduino for cortex_m3 using arm-none-eabi-gcc-7-2017q4 #1479

Closed henriksod closed 1 year ago

henriksod commented 1 year ago

Issue template

Steps to reproduce the issue

I want to compile an arduino sketch using micro_ros_arduino for Arduino DUE on a aarch64 host system (rpi 4 model B). The SAM board gcc toolchain is very old and is not officially supported on aarch64 systems by arduino. The solution is to compile using a later version (arm-none-eabi-gcc-7-2017q4) of arm-none-eabi-gcc https://github.com/arduino/arduino-cli/issues/1339

--> I need to update micro_ros_arduino to compile using arm-none-eabi-gcc-7-2017q4 when targetting cortex_m3. I am following the steps mentioned here: https://github.com/micro-ROS/micro_ros_arduino/issues/315

On a x86_64 linux machine:

  1. Install arduino-cli
  2. arduino-cli core update-index --additional-urls https://per1234.github.io/ArduinoCore-sam/package_per1234_samarm64_index.json
  3. export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS=https://per1234.github.io/ArduinoCore-sam/package_per1234_samarm64_index.json
  4. arduino-cli core install per1234:sam
  5. git clone -b 2.0.7-humble https://github.com/micro-ROS/micro_ros_arduino.git && cd micro_ros_arduino
  6. sed -i 's/4_8-2014q1/7-2017q4/g' extras/library_generation/library_generation.sh
  7. export ARDUINO_PATH=[Your Arduino path]
  8. docker run -it --rm -v $ARDUINO_PATH/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4:/toolchain -v $(pwd):/project --env MICROROS_LIBRARY_FOLDER=extras microros/micro_ros_static_library_builder:humble -p cortex_m3

Expected behavior

Should be able to compile micro_ros_arduino-2.0.7-humble using arm-none-eabi-gcc-7-2017q4.

Actual behavior

Summary: 69 packages finished [1min 35s]
  50 packages had stderr output: action_msgs actionlib_msgs builtin_interfaces composition_interfaces control_msgs diagnostic_msgs example_interfaces geometry_msgs libyaml_vendor lifecycle_msgs micro_ros_msgs micro_ros_utilities microxrcedds_client nav_msgs rcl rcl_action rcl_interfaces rcl_lifecycle rcl_logging_interface rcl_logging_noop rclc rclc_lifecycle rclc_parameter rcutils rmw rmw_implementation rmw_microxrcedds ros2trace rosgraph_msgs rosidl_cli rosidl_runtime_c rosidl_typesupport_c rosidl_typesupport_microxrcedds_c sensor_msgs sensor_msgs_py shape_msgs statistics_msgs std_msgs std_srvs stereo_msgs test_msgs test_tracetools_launch tf2_msgs tracetools_launch tracetools_read tracetools_test tracetools_trace trajectory_msgs unique_identifier_msgs visualization_msgs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
rsync is already the newest version (3.2.7-0ubuntu0.22.04.2).
0 upgraded, 0 newly installed, 0 to remove and 156 not upgraded.
rsync: [sender] change_dir "/project/src/common_interfaces/common_interfaces" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/project/src/libyaml_vendor/libyaml_vendor" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/project/src/micro_ros_utilities/micro_ros_utilities" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/project/src/microcdr/microcdr" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/project/src/microxrcedds_client/microxrcedds_client" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/project/src/rcl_logging_noop/rcl_logging_noop" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
rsync: [sender] change_dir "/project/src/rclc/rclc" failed: No such file or directory (2)
pablogs9 commented 1 year ago

Hello @henriksod I see that you have a solution, could you open a PR with a proposal for fixing this issue?

henriksod commented 1 year ago

Hi! Maybe I am confusing things here. The solution I mention is not related to micro_ros_arduino. The solution is what causes me to have issues with micro_ros_arduino.

I had two issues:

I have added some clarifying information in the topic.

henriksod commented 1 year ago

Update:

So I ran the following command strings src/cortex-m3/libmicroros.a | grep "GCC: (" and got this:

GCC: (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]

Seems like it is the correct gcc version was used after all. Maybe the error messages I got from running the docker container were misleading.

I will try to use this static library and come back.

Update 2:

I moved the generated static library file to a fresh 2.0.7-humble under src/cortex-m3/libmicroros.a and zipped the repo before installing the library again using the steps mentioned above.

Compiling the arduino sketch towards Arduino DUE from an aarch64 host now works! :rocket: