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 \
-DCMAKE_TOOLCHAIN_FILE=${PWD}/JETSON_TX2_AARCH64_CMAKE_TOOLCHAIN_FILE
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.
ExternalProject_Add(curl-7.57.0
URL https://github.com/curl/curl/releases/download/curl-7_57_0/curl-7.57.0.tar.gz
URL_MD5 c7aab73aaf5e883ca1d7518f93649dc2
CONFIGURE_COMMAND
<SOURCE_DIR>/configure
CFLAGS=${extra_c_flags}
CXXFLAGS=${extra_cxx_flags}
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${PKGCONFIG_FOR_OPENSSL}
--prefix=${CMAKE_CURRENT_BINARY_DIR}/libcurl_install
--with-ssl
BUILD_COMMAND ${MAKE}
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.
If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
ros-users@lists.ros.org
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <
http://lists.ros.org/mailman//options/ros-users>