How to setup Cross Compilation for Arm64

asked 2017-08-22 00:03:56 -0500

oxoocoffee gravatar image

updated 2017-08-25 11:10:47 -0500


I am looking into cross compiling my ROS kinetic project that run on x64 to arm64. I have been reading several posts and links here and there. What I gathered is that some install rebuild ROS arm64 packages and some build ROS from scratch. My question is how do you install ROS arm64 libs on my Ubuntu Desktop (x64) to be able cross compile my project? I did try dpkg --add-archtecture arm64 and after apt-get update I did try to install ros-kinetix-ros-core. sudo apt-get install ros-kinetix-ros-core:arm64 but this fails. Is this the correct doing it? Or building from source is better way to go. I do not find clear information about this anywhere.

If you are familiar with this could you share except steps you did to get ROS cross compilation working?

Edit: Ok per your request let me explain what I am trying to do in grater detail. I ma doing this first time so I might have wrong assumptions.

As of now I have a ROS Kinetic project that I did build on my Ubuntu 16.04 x64 Desktop. This works just fine. Now what I want to do is cross compile my project my my desktop for arm64. From my reading there are two options

  1. Cross compile entire ROS on my desktop for arm64
  2. Install already prebuild ROS arm64 packages on my Desktop x64

Before cross compiling entire ROS first I am trying to figure out step 2

For that reason I created new Ubuntu 16.04 x64 VM and now I am trying to install only ROS arm64 on it to cross compile my project. To do this I did read , and

So in my fresh VM here are the steps I took ( )

  1. sudo sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  2. sudo apt-key adv --keyserver hkp:// --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
  3. sudo dpkg --add-architecture


  4. dpkg --print-foreign-architectures

    i386 arm64

  5. Modify ros-latest.list in /etc/apt/sources.list.d

    deb [arch=amd64,arm64] xenial main

  6. Create arm64-xenial.list in /etc/apt/sources.list.d with contents

    deb [arch=arm64,amd64] xenial main restricted universe multiverse
    deb [arch=arm64,amd64] xenial-security main restricted universe multiverse
    deb [arch=arm64,amd64] xenial-backports main restricted universe multiverse
    deb [arch=arm64,amd64] xenial main multiverse universe restricted
    deb [arch=arm64,amd64] xenial-updates main multiverse universe

    restricted deb [arch=arm64,amd64] xenial-security main multiverse universe restricted

  7. sudo apt-get update

  8. sudo apt-get install crossbuild-essential-arm64
  9. Then I did try to install ros-kinetic-ros-core:arm64

At this point I got these message

# sudo apt-get install ros-kinetic-ros-base:arm64
Reading package lists... Done
Building dependency tree       
Reading ...
edit retag flag offensive close merge delete



just making sure: the release name is Kinetic, not Kinetix. So depending on your exact OS, ros-kinetic-ros-core should work.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-22 01:34:25 -0500 )edit

Sorry, It was a typo... Still is it possible to install Arm64 ROS development packages on Ubuntu 16.06 x64 desktop to do cross compilation? If so what am I doing or missing above?


oxoocoffee gravatar image oxoocoffee  ( 2017-08-22 08:26:40 -0500 )edit

I'm far from a cross-compilation expert, but the first thing would be to describe what it is exactly that "fails". Be specific.

Also: catkin == CMake. So I would look up resources about cross-compilation with CMake.

Note that even then it's not trivial to get this to work correctly.

gvdhoorn gravatar image gvdhoorn  ( 2017-08-22 08:30:37 -0500 )edit

I have few project cross compiling with cmake that do not need ROS. So I ma familiar with it. I just need to install arm64 ros packages so I can build against it.

oxoocoffee gravatar image oxoocoffee  ( 2017-08-22 12:17:44 -0500 )edit

Did you ever solve this? I'm running into the same problem. It looks like some packages that ROS relies on don't play with multi-arch very well, at least on ubuntu xenial and ros kinetic.

femtogram gravatar image femtogram  ( 2019-04-30 09:37:52 -0500 )edit