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

Revision history [back]

click to hide/show revision 1
initial version

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 http://www.emdebian.org/debian/ 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_SYSTEM_NAME Linux)
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_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 
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 env.sh   setup.bash  setup.sh  _setup_util.py  setup.zsh /opt/ros/beagleboard

edit setup.sh 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 \
-DCMAKE_BUILD_TYPE=Debug

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 build_isolated/tf/CMakeFiles/tf_empty_listener.dir/link.txt
vi build_isolated/tf/CMakeFiles/tf_monitor.dir/link.txt

the following packages could not be properly installed they have to be manually installed repeat this step with the other packages

cd src/cpp_common
mkdir build;cd build
cmake -DCMAKE_TOOLCHAIN_FILE=~/robot/ros/catkin_workspace_armhf/src/rosbuild/core/rosbuild/ros_armhf_toolchain.cmake -DCMAKE_INSTALL_PREFIX=/opt/ros/beagleboard -DCMAKE_VERBOSE_MAKEFILE=true -DBUILD_SHARED_LIBS=ON ..
make install
cd ..

start a second compilation

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 \
-DCMAKE_BUILD_TYPE=Debug

At this step, the tree /opt/ros/beagleboard is ready to be transfered to the board

On the board, install the missing packages alternative: you may get the packages created by xapt in /var/lib/xapt/output, to copy them to the board and install the required deb files via dpkg

sudo apt-get install libboost-system1.49.0 libboost-filesystem1.49.0 libboost-program-options1.49.0 libboost-signals1.49.0 \
libboost-regex1.49.0 libboost-date-time1.49.0 libboost-thread1.49.0 liblog4cxx10 libpython2.7 python2.7 libtinyxml2.6.2 bzip2 libtiff4 libassimp3 libpococrypto9 libpocodata9 libpocofoundation9 libpocomysql9 \
libpoconet9 libpoconetssl9 libpocoodbc9 libpocosqlite9 libpocoutil9 libpocoxml9 libpocozip9 \
python-netifaces python-yaml python-catkin-pkg python-empy python-nose

transfer the tree /opt/ros/beagleboard from the PC to the board if required, update your /etc/hosts to add the PC host address

192.168.1.7       debian-pc

Update $HOME/.bashrc to add the following lines (customize if necessary)

source /opt/ros/beagleboard/setup.bash
export ROS_HOSTNAME=debian-pc
export ROS_MASTER_URI=http://debian-pc:11311

you may now try the beginner_tutorials

source $HOME/.bashrc

install talker on the PC and listener on the board for instance

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 http://www.emdebian.org/debian/ 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_SYSTEM_NAME Linux)
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_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 
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 env.sh   setup.bash  setup.sh  _setup_util.py  setup.zsh /opt/ros/beagleboard

edit setup.sh 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 \
-DCMAKE_BUILD_TYPE=Debug

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 build_isolated/tf/CMakeFiles/tf_empty_listener.dir/link.txt
vi build_isolated/tf/CMakeFiles/tf_monitor.dir/link.txt

the following packages could not be properly installed they have to be manually installed repeat this step with the other packages

cd src/cpp_common
mkdir build;cd build
cmake -DCMAKE_TOOLCHAIN_FILE=~/robot/ros/catkin_workspace_armhf/src/rosbuild/core/rosbuild/ros_armhf_toolchain.cmake -DCMAKE_INSTALL_PREFIX=/opt/ros/beagleboard -DCMAKE_VERBOSE_MAKEFILE=true -DBUILD_SHARED_LIBS=ON ..
make install
cd ..

start a second compilation

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 \
-DCMAKE_BUILD_TYPE=Debug

At this step, the tree /opt/ros/beagleboard is ready to be transfered to the board

On the board, install the missing packages alternative: you may get the packages created by xapt in /var/lib/xapt/output, to copy them to the board and install the required deb files via dpkg

sudo apt-get install libboost-system1.49.0 libboost-filesystem1.49.0 libboost-program-options1.49.0 libboost-signals1.49.0 \
libboost-regex1.49.0 libboost-date-time1.49.0 libboost-thread1.49.0 liblog4cxx10 libpython2.7 python2.7 libtinyxml2.6.2 bzip2 libtiff4 libassimp3 libpococrypto9 libpocodata9 libpocofoundation9 libpocomysql9 \
libpoconet9 libpoconetssl9 libpocoodbc9 libpocosqlite9 libpocoutil9 libpocoxml9 libpocozip9 \
python-netifaces python-yaml python-catkin-pkg python-empy python-nose

transfer the tree /opt/ros/beagleboard from the PC to the board if required, update your /etc/hosts to add the PC host address

192.168.1.7       debian-pc

Update $HOME/.bashrc to add the following lines (customize if necessary)

source /opt/ros/beagleboard/setup.bash
export ROS_HOSTNAME=debian-pc
ROS_IP=<beagleboard_ip>
export ROS_MASTER_URI=http://debian-pc:11311

you may now try the beginner_tutorials

source $HOME/.bashrc

install talker on the PC and listener on the board for instance