This is an old revision of the document!
Ubuntu cross compiling with libraries
This guide describes how to cross compile for aarch64 targets with linking to external libraries from a Ubuntu host. The cross compilation is tested on a x86_64 host running Ubuntu 20.04, a target running Ubuntu aarch64 (Raspberry Pi 4B) and using the cmake build tool. It links external libraries by mounting the target filesystem over ssfs
On target
Install external libraries (OMPL: lib-eigen3-dev, boost libraries)
On host
sudo apt-get install g++-aarch64-linux-gnu
Mount filesystem of rpi sudo mkdir /mnt/rpi sudo sshfs -o allow_other,default_permissions ubuntu@192.168.2.171:/ /mnt/rpi
Configure cmake to use toolchain file cmake -DCMAKE_TOOLCHAIN_FILE=../dune/toolchain.cmake ../dune make -j8
Toolchain file
set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR aarch64) set(tools /usr/bin) set(CMAKE_C_COMPILER ${tools}/aarch64-linux-gnu-gcc-9) set(CMAKE_CXX_COMPILER ${tools}/aarch64-linux-gnu-g++-9) set(CMAKE_SYSROOT /mnt/rpi) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)