cross compile ros2 for arm64 board

asked 2019-08-09 00:24:17 -0600

zcm gravatar image

Hello, all, I have some problems when I cross compile ros2 master branch from source for my arm64 board.

Fist my command: colcon build \ --cmake-force-configure \ --merge-install \ $target \ --cmake-args \ --no-warn-unused-cli \ -DCMAKE_TOOLCHAIN_FILE=$cmake_file \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DBUILD_TESTING:BOOL=OFF \ -DTHIRDPARTY=ON \ -DSECURITY=OFF

Second CMake toochain file:

set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR aarch64)

specify the cross compiler

set(CMAKE_C_COMPILER $ENV{CROSS_COMPILE}gcc) set(CMAKE_CXX_COMPILER $ENV{CROSS_COMPILE}g++)

set(CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR}/install) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

And I didn't set CMAKE_SYSROOT , because what I build have not outside dependencies except the cross toolchain.

Now The problem is although I can successfully compile all so library, ld program failed when find these so library.

Starting >>> examples_rclcpp_minimal_publisher --- stderr: examples_rclcpp_minimal_publisher
/opt/hisi-linux/x86-arm/aarch64-himix100-linux/host_bin/../lib/gcc/aarch64-linux-gnu/6.3.0/../../../../aarch64-linux-gnu/bin/ld: warning: libfastrtps.so.1, needed by /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_fastrtps_c.so, not found (try using -rpath or -rpath-link) /opt/hisi-linux/x86-arm/aarch64-himix100-linux/host_bin/../lib/gcc/aarch64-linux-gnu/6.3.0/../../../../aarch64-linux-gnu/bin/ld: warning: libfastcdr.so.1, needed by /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_fastrtps_c.so, not found (try using -rpath or -rpath-link) /opt/hisi-linux/x86-arm/aarch64-himix100-linux/host_bin/../lib/gcc/aarch64-linux-gnu/6.3.0/../../../../aarch64-linux-gnu/bin/ld: warning: libPocoFoundation.so.50, needed by /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librmw_implementation.so, not found (try using -rpath or -rpath-link) /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so: undefined reference to eprosima::fastcdr::Cdr::setState(eprosima::fastcdr::Cdr::state&)' /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so: undefined reference toeprosima::fastcdr::Cdr::state::state(eprosima::fastcdr::Cdr const&)'

I review the Makefile created by colcon and I found that g++ don't even link these library ...

/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-g++ CMakeFiles/publisher_not_composable.dir/not_composable.cpp.o -o publisher_not_composable /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librclcpp.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosidl_typesupport_fastrtps_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosidl_typesupport_fastrtps_cpp.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_cpp.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_fastrtps_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_generator_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_introspection_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_interfaces__rosidl_typesupport_introspection_cpp.so -lpthread /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librmw_implementation.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librmw.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcutils.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_logging_noop.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosgraph_msgs__rosidl_typesupport_cpp.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosgraph_msgs__rosidl_typesupport_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosgraph_msgs__rosidl_generator_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosgraph_msgs__rosidl_typesupport_introspection_cpp.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosgraph_msgs__rosidl_typesupport_introspection_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosgraph_msgs__rosidl_typesupport_fastrtps_c.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librosgraph_msgs__rosidl_typesupport_fastrtps_cpp.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/libyaml.so /home/zhouchengming/ros2_arm/ros2_ws/install/lib/librcl_yaml_param_parser.so /home/zhouchengming/ros2_arm/ros2_ws ... (more)

edit retag flag offensive close merge delete