[ros-users] [Discourse.ros.org] [Next Generation ROS] How to cross-compile ROS2 for arm64 architecture

Adam Jiang ros.discourse at gmail.com
Mon Jan 15 03:32:57 UTC 2018

I am trying to cross-compile ROS2 for arm64 ubuntu box. It was going well until hitting an issue in 'resource_retriever'.

    Scanning dependencies of target resource_retriever
    [ 50%] Building CXX object CMakeFiles/resource_retriever.dir/src/retriever.cpp.o
    [100%] Linking CXX shared library libresource_retriever.so
    /home/sirius/projects/ros2/build_isolated/libcurl_vendor/libcurl_install/lib/libcurl.so: error adding symbols: File in wrong format
    collect2: error: ld returned 1 exit status
    CMakeFiles/resource_retriever.dir/build.make:96: recipe for target 'libresource_retriever.so' failed
    make[2]: *** [libresource_retriever.so] Error 1
    CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/resource_retriever.dir/all' failed
    make[1]: *** [CMakeFiles/resource_retriever.dir/all] Error 2
    Makefile:127: recipe for target 'all' failed
    make: *** [all] Error 2

Here is the command for cross-compiling

    ./src/ament/ament_tools/scripts/ament.py build --isolated \
    --skip-packages rviz_assimp_vendor rviz_ogre_vendor \
                    rviz_yaml_cpp_vendor rviz_rendering rviz_rendering_tests \
                    rviz_common rviz2 rviz_default_plugins ros1_bridge \
    --symlink-install \
    --cmake-args -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
                 -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
                 -DCMAKE_LINKER=aarch64-linux-gnu-ld \

The reason of the failure seems to be related to 'ExternalProject_Add' macro for CONFIGURE_COMMAND doesn't take cross-compiling arguments into 'autoconf/automake' style packages.

      URL https://github.com/curl/curl/releases/download/curl-7_57_0/curl-7.57.0.tar.gz
      URL_MD5 c7aab73aaf5e883ca1d7518f93649dc2
      INSTALL_COMMAND make install
      TIMEOUT 600

It makes me think if the method for cross-compiling is right...

How could I cross-compile ROS2 for arm64? Is there a step-by-step guide on this?

[Visit Topic](https://discourse.ros.org/t/how-to-cross-compile-ros2-for-arm64-architecture/3702/1) or reply to this email to respond.

More information about the ros-users mailing list