wiki:WikiStart/Toolchain/XcompiledRTT

* UNDER CONSTRUCTION *

Cross-compiling Orocos/RTT for ARM architecture

In order to cross compiling we try to use as much of autoproj as possible. Currently, cross-compilation support does not exist with autoproj. In addition to that, some RTT dependencies such as omniORB have their own bootstrap installation process.

Future approaches might involve the application of xapt and dpkg-cross. However, for now xapt is only available for Debian sid(unstable) and wheezy(testing) and yet no backports exist. The following guide a current workaround to build Orocos for ARM.

The following procedure will use the existing tools/rtt source folder and install into the $AUTOPROJ_PROJECT_BASE/install folder. It is thus a good idea, to keep one source tree for cross-compilation and one for native-compilation.

The current work-flow assumes to wide parts that you install into the same $AUTOPROJ_PROJECT_BASE/install folder on your target system .

Integration into Autoproj

We use autoproj to retrieve the required source packages using the attached rtt.arm package set. Just extract it into your autoproj folder and add: rtt.arm to the list of package sets in your manifest file. (Alternatively, you can also use an existing one and add the entries of the rtt.arm package.set) Boost, xerces, and omniORB will be cross-compiled for ARM.

NOTE: codesourcery is assumed to be installed into /opt/codesourcery. You might have to adapt the init.rb file in the rtt.arm package set if you choose a different location for codesourcery install - you can also allow codesourcery's installer to adapt the PATH variable.

Recreate env.sh

Before using the scripts which install codesourcery, rtt dependencies and build rtt, update the env.sh using:

autoproj envsh
source env.sh

Applying the provided set of scripts

Extract the provided script folder and extract into the $AUTOPROJ_PROJECT_BASE/arm directory (just for consistency reasons, since the rtt dependencies will be also installed into the $AUTOPROJ_PROJECT_BASE/arm/ directory ).

In order to start the cross-compilation procedure call from $AUTOPROJ_PROJECT_BASE/arm/install_scripts

ruby build-rtt.rb




Cross-compiling Orocos/RTT for ARM architecture -- The RAW guide

In contrast to the integrated approach described above, this guide provides a rather raw guideline on how to achieve a cross compiled version of RTT. This can be used as alternative to the above guide.

Requirements and notes

This procedure has been used to deploy Orocos on an Gumstix Overo Fire board. The kit consists of:

  • Gumstix Overo Fire board and Tobi expansion board
  • Bootable microSD for Gumstix running Debian Squeeze
  • use putty for connecting to the Gumstix

Dependencies of RTT

We need to have the basic dependencies of RTT cross-compiled on the desktop PC, before we can start cross-compiling RTT.

  • Boost 1.44
  • OmniORB 4.1.4
  • Xerces

Cross-compiling Boost 1.44

Download Boost (tested with 1.44, http://sourceforge.net/projects/boost/files/boost/1.44.0/ ), extract and step in its folder. <path to toolchain> denotes CodeSourcery’s ARM cross-compiler toolchain’s path. Run

cd tools/jam/src/
./build.sh
cp bin.linuxx86/* .
export PATH=<path_to_boost>/boost_1_44_0/tools/jam/src:$PATH
cd ../../..
echo "using gcc : 4.4.1 : <path_to_toolchain>/bin/arm-none-linux-\
gnueabi-g++ ; " > tools/build/v2/user-config.jam
bjam -d2 --toolset=gcc ’-sBUILD=release static multi/single’ link=\
static --prefix=\ --layout=system stage
bjam install --prefix=/opt/boost

Possible issues: many packages get skipped due to the nonexistence of long doubles on ARM (this is fine). Also, some distributions do not add “-mt” to sign the library as multithreaded, Orocos might ask for it, just duplicate the non-mt *.so and *.a and name them *-mt.a/so (or create symlinks to them).

Note: In case you’re experiencing problems with missing bzip2 and zlib headers, either add -sBZIP NO=1 -sZLIB NO=1 to the bjam params (to line 7) or alternatively copy the headers and the cross-compiled *.so files of bzip and zlib (can be taken straight from the Gumstix) to the libs/iostreams/src folder.

Cross-compiling OmniORB 4.1.4

Download OmniORB 4.1.4. ( http://sourceforge.net/projects/omniorb/files/omniORB/omniORB-4.1.4/ ), extract and step in its folder. <omniorb cross path> denotes any arbitrary folder where omniORB will be cross-compiled.

export PATH=$PATH:<path_to_toolchain>/bin
make clean
./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-\
g++ --host=arm-unknown-linux-gnu --prefix=<omniorb_cross_path>
make CC=gcc -C src/tool/omniidl/cxx/cccp
make CXX=g++ -C src/tool/omniidl/cxx
make CC=gcc -C src/tool/omkdepend
make
make install

We will need to copy the following files files from <omniorb cross path> to the Gumstix’ /usr/lib/ folder (or your autoproj install folder) as well:

  • libCOS4.so
  • libCOS4.so.1
  • libCOS4.so.1.4
  • libCOS4.a
  • libCOSDynamic4.so
  • libCOSDynamic4.so.1
  • libCOSDynamic4.so.1.4
  • libCOSDynamic4.a

Getting Xerces - ARM version

This one does not need to get cross-compiled, but just installed it on the Gumstix board via simple apt-get install libxerces-c2-dev libxerces-c28,and copied(scp-d over)the installed includes and libs to a folder on the Desktop PC <xerces install dir>. Move all the subdirectories from the <xerces_install_dir>/include folder to a subfolder called <xerces_install_dir>/include/xercesc. Also, an environmental variable needs to be set:

export XERCES_ROOT_DIR=<xerces_install_dir>

Alternatively, crosscompiling Xerces from source:

export PATH=$PATH:<path_to_toolchain>/bin
./configure CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ --host=arm-unknown-linux-gnueabi --disable-threads --prefix=<xerces_install_dir
make && make install

Cross-compiling RTT

git clone git://gitorious.org/+rock-core-maintainers/orocos-toolchain/rock-rtt.git rock-rtt
cd rock-rtt
mkdir build
cd build 
CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++ cmake ..\
-DCROSS_COMPILE=arm-none-linux-gnueabi- -DCMAKE_INSTALL_PREFIX=<\ orocos_cross_path> -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIOR\ B -DOMNIORB4_DIR:PATH=<omniorb_cross_path> -DOMNIORB4_INCLUDE_DI\ R=<omniorb_cross_path>/include/ -DOMNIORB4_LIBRARY_Dynamic4=<\ omniorb_cross_path>/lib/libomniDynamic4.so -DOMNIORB4_LIBRARY\ _omniORB4=<omniorb_cross_path>/lib/libomniORB4.so -DOMNIORB4\ _LIBRARY_omnithread=<omniorb_cross_path>/lib/libomnithread.so -DO\ S_NO_ASM=ON -DXERCES_ROOT_DIR=<xerces_install_dir> -DXERCES_C_LIBRARY=<xerces_install_dir>/lib/libxerces-c.so.28 -DXERCES_INCLUDE_DIR=<xerces_install_dir>/include  -DDEFAULT_PLUGIN_PATH=<install_path_on_gumstix>/lib/orocos

Change the package-config files (<orocos cross path>/lib/pkgconfig/*.pc-s), so that all the paths match the corresponding paths needed on the Gumstix. Copy the <orocos cross path>’s content to the development folder’s install subfolder on the Gumstix, and change autoproj/manifest by adding

ignore_packages:
  - rtt

Troubleshooting

Omniorb startup failure on Gumstix

Delete /var/lib/omniorb/* and reboot.

Alternative (using Ubuntu 12.04)

Using Ubuntu 12.04 allows you to easily create a qemu based chroot to perform your cross-compilation. The following gives a premature outline of the steps needed to setup your environment.

Sources

Using Ubuntu 12.04

Steps

* Note: the following list assume familarity with debian based systems and the typical rock-installation process *

Preparing the chroot

  • install qemu-user-static
       apt-get install qemu-user-static
    
  • boostrap a selected debian/ubuntu release, i.e. create you chroot image
    • in case you what to use an older release, you might have to refer to archives, i.e. set the links correspondingly. In the following we list two examples, one requiring archives (lenny) one not (squeeze)
    • example: debian lenny:
         sudo qemu-debootstrap --arch armel --foreign lenny eabi-chroot-lenny http://archive.debian.org
      
    • example: debian sequeeze
         sudo qemu-debootstrap --arch armel --foreign squeeze eabi-chroot-squeeze http://ftp.debian.org
      
  • change into your chroot and update the apt-sources list
        sudo chroot eabi-chroot-squeeze
       
    
  • update apt source list
        vi /etc/apt/sources.list
    
  • add the repositories, you might also want to add 'contrib non-free updates'
      # deb http://archive.debian.org/debian lenny main
      deb http://ftp.debian.org/debian squeeze main 
    
  • update your chroot
       apt-get update
       apt-get upgrade
    

Setting up autoproj

You can follow the normal autoproj boostrap, if you perfrom the following steps before:

  • install some packages manually, e.g.
     sudo apt-get install ruby wget gem git-core pkg-config doxygen locales
     dpkg-reconfigure locales
    
  • set the autoproj operating system enviroment variable, e.g.
    export AUTOPROJ_OS=lenny,debian:5.0.10
    export AUTOPROJ_OS=sequeez,debian:6.0.5
    

Also the installation of osdeps seems to be of an issue, i.e. does not work reliably. However, since installation has to be performed only once, this should not be a showstopper. Try using 'autoproj osdeps' or in worst case identify the required package and install it via 'apt-get install' yourself.

Using the chroot

  • To avoid some error messages perform the following commands to link your host into the chroot system, before you change into your chroot:
        mount -t proc none <chroot-folder>/proc
        mount -o bind /dev <chroot-folder>/dev
    
  • currently adding the 'noexecstack' flag needs to be disabled in base/types/cmake/RubyExtension.cmake for armel
Last modified 2 years ago Last modified on 08/27/12 12:09:58

Attachments (3)

Download all attachments as: .zip