ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to cross-compile ROS for BeagleBoard-xM (ARM)

asked 2011-02-28 02:55:26 -0500

tom gravatar image

updated 2014-01-28 17:09:14 -0500

ngrennan gravatar image

I'd like to cross-compile ROS stacks for a BeagleBoard-xM. How should I proceed? I haven't got any experience with cross-compilation. I've read there is a stack for this purpose called eros, is it still alive? Or is it better to go with OpenEmbedded or CodeSourcery, or is rostoolchain.cmake enough?

I've already managed to build all the stacks necessary by compiling them directly on the BB-xM once (Ubuntu 10.10), but this takes a lot of time and is prone to errors (see here or here). So I'd like to learn how to cross-compile to avoid such problems in the future.

Any hints appreciated.

edit retag flag offensive close merge delete

5 Answers

Sort by ยป oldest newest most voted

answered 2011-02-28 14:54:14 -0500

Daniel Stonier gravatar image

updated 2011-02-28 18:56:36 -0500

In answer to your question, I think you need to understand the roles of each

  • OpenEmbedded : its a system builder, as you already have ubuntu installed, you dont need it. It can build you toolchains, but there are probably easier ways to get a toolchain if you already have ubuntu installed.
  • CodeSourcery : it's a toolchain (cross compiler + utilities). I haven't actually had any problems with these, and eros even has a package which helps you install a code sourcery g++/glibc toolchain on 32 bit systems.
  • Eros is not a system builder, nor a toolchain. It simply brings all the elements together so that you can cross-compile ros easily.

As for the situation you have described, you don't need to worry about a system builder. The next step is a toolchain, code sourcery should be ok, though I also see maverick now includes arm-linux toolchains. These latter toolchains will probably be a better fit (no chance of libc/libc++ mismatches) but I haven't tested them myself.

Once you have a toolchain, you can use eros to help you do a toolchain bridge (i.e. install the apache runtimes, log4cxx and boost into your toolchain) and globally configure the ros environment for cross compiling.

This will work well for simple systems, but if you're using large stacks of packages with alot of other rosdeps, then it probably isn't viable as you haven't got a good means of installing those rosdeps into your toolchain. Eros could add build scripts for some of these, though I'd like to see eros fill this need by using something like openembedded under the hood to do so. If you have an ubuntu already installed, a simple hack that might work is to copy libs and headers for rosdeps from your board across into your toolchain.

edit flag offensive delete link more

answered 2011-02-28 18:42:42 -0500

KoenBuys gravatar image

You can find the explanation of Markus Klotzbuecher for our students embedded control systems here: this is based on the standard gcc arguments.

edit flag offensive delete link more


Thanks Koen, very nice introductory materials.
tom gravatar image tom  ( 2011-03-01 00:13:17 -0500 )edit

answered 2013-11-01 08:10:15 -0500

Fabien R gravatar image

updated 2013-11-19 03:53:57 -0500

This is how I managed to cross-compile groovy for the beagleboard-XM running debian-armhf/stable.

It requires that you already have a groovy functional version on the host and a corresponding catkin_workspace containing the sources. it is of course not the only way to proceed, but it worked for me. it is tested under the following environment:

host system: debian-amd64/wheezy. groovy installed in /opt/ros/groovy 
target system: debian-armhf/wheezy. groovy will be installed in /opt/ros/beagleboard

on the host system, the cross-compiler must be installed. edit and update the sources.list to add the emdebian repository

deb <a href=""></a> unstable main

install gcc for armhf

sudo apt-get install g++-4.7-arm-linux-gnueabihf

groovy must be prepared to be cross-compiled. create a copy of the groovy workspace for armhf. (customize the path if required)

cp -rv ~/robot/ros/catkin_workspace_amd64 ~/robot/ros/catkin_workspace_armhf

create the configuration file configuration ros_armhf_toolchain.cmake from rosbuild/rostoolchain.cmake

cd ~/robot/ros/catkin_workspace_armhf
cp -v ./src/rosbuild/core/rosbuild/rostoolchain.cmake ./src/rosbuild/core/rosbuild/ros_armhf_toolchain.cmake

edit the file to update the following variables

set(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc-4.7)
set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++-4.7)
set(CMAKE_INSTALL_PREFIX /opt/ros/beagleboard)
set(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf) # armhf dependencies install dir
set(CATKIN_ENABLE_TESTING OFF) # enable if required

install the missing libraries (you may work in a chroot if you prefer)

sudo xapt --keep-cache -a armhf -m libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libpython2.7 python2.7-dev  libboost-signals-dev libboost-regex-dev libboost-date-time-dev libboost-thread-dev liblog4cxx10-dev libtinyxml-dev libbz2-dev libeigen3-dev libtiff-dev libassimp-dev libpoco-dev

There's perhaps a cleaner way to perform this step, but I did not find it. Copy the environment files from groovy

mkdir -p /opt/ros/beagleboard
cd /opt/ros/groovy
cp -v   setup.bash  setup.zsh /opt/ros/beagleboard

edit to replace /opt/ros/groovy with /opt/ros/beagleboard

cd /opt/ros/beagleboard

launch a first compilation (you may of course add other packages)

source setup.bash
cd ~/robot/ros/catkin_workspace_armhf
./src/catkin/bin/catkin_make_isolated --pkg  roslib roscpp  rostime rosconsole roscpp_serialization xmlrpcpp message_filters tf actionlib_msgs actionlib catkin rosbash roslaunch rosparam  rosservice  rostest  rostopic  topic_tools rosmsg rosbag genpy rospkg genmsg rosclean rosgraph_msgs rosmaster rosout rosgraph std_msgs --install --install-space /opt/ros/beagleboard   -DCMAKE_TOOLCHAIN_FILE=~/robot/ros/catkin_workspace_armhf/src/rosbuild/core/rosbuild/ros_armhf_toolchain.cmake -DCMAKE_VERBOSE_MAKEFILE=true \

at this step, this first compilation ended because of linker errors. Edit the following files to replace groovy with beagleboard (you may also use awk for that)

cd ~/robot/ros/catkin_workspace_armhf
vi build_isolated/rosconsole/CMakeFiles/rosconsole.dir/link.txt
vi build_isolated/roscpp/CMakeFiles/roscpp.dir/link.txt
vi build_isolated/tf/CMakeFiles/tf.dir/link.txt
vi build_isolated/tf/CMakeFiles/pytf_py.dir/link.txt
vi build_isolated/tf/CMakeFiles/static_transform_publisher.dir/link.txt
vi build_isolated/tf/CMakeFiles/testBroadcaster.dir/link.txt
vi build_isolated/tf/CMakeFiles/tf_change_notifier.dir/link.txt
vi build_isolated/tf/CMakeFiles/tf_echo.dir/link.txt
vi ...
edit flag offensive delete link more

answered 2011-02-28 13:54:48 -0500

joq gravatar image

Yes, the EROS project is still active. Cross-compiling ROS for embedded projects still seems to be challenging.

Perhaps they can assist.

edit flag offensive delete link more

answered 2011-02-28 06:18:57 -0500

adasta gravatar image

While you can cross compile ROS for the Beagleboard-XM, the easiest thing to do will be do just compile ROS directly on it. The beagle board is fast enough that it only takes a few hours to basic ROS from svn.

Just load a Ubuntu image onto your SD card and do the standard svn install for D-turtle and it should work.

edit flag offensive delete link more


Thanks, but I've been there before. Usually compiling sources directly on the BB-xM is the easiest solution, but in case of stacks like PCL (which needs over 1GB RAM to compile) this really causes errors (see links above).
tom gravatar image tom  ( 2011-02-28 17:26:39 -0500 )edit

Question Tools

1 follower


Asked: 2011-02-28 02:55:26 -0500

Seen: 6,125 times

Last updated: Nov 19 '13