0

I'm trying to cross compiling ROS Melodic for aarch64 on raspberry pi 3 with toolchain that created by buildroot.

I followed the document http://wiki.ros.org/ROS/CrossCompiling/RaspberryPi/Cross-Compile%20ROS%20for%20the%20RaspberryPi, the source of ROS I try to build comes from:

rosinstall_generator ros_comm --rosdistro melodic --deps --tar > melodic-ros_comm.rosinstall
wstool init -j8 src melodic-ros_comm.rosinstall

And I got the error messages like these:

[100%] Linking CXX shared library /home/developer/ros_pi/ros_catkin_ws/devel_isolated/class_loader/lib/libclass_loader.so
/home/developer/buildroot-2020.02.1/output/host/lib/gcc/aarch64-buildroot-linux-gnu/8.4.0/../../../../aarch64-buildroot-linux-gnu/bin/ld: /home/developer/buildroot-2020.02.1/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libboost_thread.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
CMakeFiles/class_loader.dir/build.make:180: recipe for target '/home/developer/ros_pi/ros_catkin_ws/devel_isolated/class_loader/lib/libclass_loader.so' failed
make[2]: *** [/home/developer/ros_pi/ros_catkin_ws/devel_isolated/class_loader/lib/libclass_loader.so] Error 1
CMakeFiles/Makefile2:195: recipe for target 'CMakeFiles/class_loader.dir/all' failed
make[1]: *** [CMakeFiles/class_loader.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
<== Failed to process package 'class_loader': 
  Command '['/home/developer/ros_pi/ros_catkin_ws/install_isolated/env.sh', 'make', '-j8', '-l8']' returned non-zero exit status 2

Reproduce this error by running:
==> cd /home/developer/ros_pi/ros_catkin_ws/build_isolated/class_loader && /home/developer/ros_pi/ros_catkin_ws/install_isolated/env.sh make -j8 -l8

Command failed, exiting.

This is my toolchain.cmake:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)

set(CMAKE_LIBRARY_ARCHITECTURE aarch64)

set( CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/home/developer/buildroot-2020.02.1/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/")

set( CMAKE_C_COMPILER   aarch64-linux-gcc)
set( CMAKE_CXX_COMPILER aarch64-linux-g++)

set(CMAKE_FIND_ROOT_PATH "/home/developer/buildroot-2020.02.1/output/host/aarch64-buildroot-linux-gnu/sysroot")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

include_directories(/home/developer/buildroot-2020.02.1/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/)

I guess the problem comes from boost? The version of boost which I used is 1.65.1

All the steps I tried is contained in Dockerfile as link as below:
https://github.com/i-am-neet/cc-ros/blob/master/Dockerfile

Thank you for your patience

NEET
  • 61
  • 1
  • 2
  • 11
  • (This isn't a helpful comment, but it tends to save a lot of time: if you can run a distro that supports ros, that would help significantly. [aarch64 is experimentally supported by Arch Linux](http://wiki.ros.org/melodic/Installation/ArchLinux). This could be your quickest way to get up and running.) – JWCS Jun 08 '20 at 03:07
  • (This also may not be helpful, but you should be able to install ros on a rpi3 that has ubuntu 18 installed. As this seems like the purpose of what you're trying to do. And I may be mistaken about this, but (almost always?) [aarch64 == arm64](https://stackoverflow.com/q/31851611/6069586), so replacing that name in your build/search might work just as well) – JWCS Jun 08 '20 at 03:14
  • @JWCS Thank you for your suggestion. I'm trying to rebuild my filesystem. – NEET Jun 10 '20 at 07:23
  • Any luck @NEET? I am having the same issues on ROS melodic/neotic – Itamar Jan 13 '21 at 06:51
  • @Itamar Unfortunately, I haven't solved the problem :(( Maybe the simple and quickly way is install ROS by `apt`. Or maybe ROS2 has better compatibility for cross compiling. – NEET Jan 13 '21 at 15:32
  • @NEET, Thanks, I am still working on it. I will let you know as soon as I know more about it. – Itamar Jan 14 '21 at 06:52

0 Answers0