Skip to content
myeisha edited this page Jul 15, 2013 · 3 revisions

Compiling packages on the RaspberryPi can be quite slow and is prone to crash compilers with out of memory-errors. As such, it is preferable build executables and libraries for the RaspberryPi on more powerful machines, e.g. a desktop PC, with a crosscompiler. This page will help you set up a crosscompiling environment.

Getting the compilers (Ubuntu 12.04)

First, create a directory raspbian-toolchain in your home directory. Change to that directory, and clone the official RaspberryPi toolchain repository:

mkdir $HOME/raspbian-toolchain
cd $HOME/raspbian-toolchain
git clone https://github.com/raspberrypi/tools.git

Into the directory tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian, place the ToolchainRaspi.cmake file from https://gist.github.com/myeisha/306854d42a0b86a4d32b.

If you are running a 32bit system, the compiler is now ready to run. If you are running a 64bit system, you will have to install ia32-libs.

Run export PATH=$HOME/raspbian-toolchain/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH to add the toolchain to your path. The compiler is now ready to run.

Installing libraries into the toolchain

First, create the directory opt in the toolchain root:

mkdir $HOME/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/opt

Create a temporary directory somewhere in your system. This guide will use /tmp/tctemp. Change to that directory, place the toolchain-init.sh file from https://gist.github.com/myeisha/306854d42a0b86a4d32b there and execute it:

mkdir /tmp/tctemp
cd /tmp/tctemp
# get toolchain-init.sh
./toolchain-init.sh

This will take a while. After the script has run, your toolchain will contain all required libraries to build hexabus binaries.

Building Hexabus package

First, place the file cconf.sh from https://gist.github.com/myeisha/306854d42a0b86a4d32b somewhere in your system. Source the file into your shell. For any hexabus package you want to build, change into the appropriate directory and use the cconf shell function to generate a configuration.

Most Hexabus packages will require arguments to the cconf function:

  • libklio: -boost -openssl -json -curl -sqlite
  • hba: -boost
  • hbc: -boost
  • hexanode backend: -boost -openssl -alsa -cppnet
  • hexinfo: -boost
  • libhexabus: -boost

After cconf has run, simply run make package to compile and build a .deb package file. If you want to compile software that depends on what you just compiled, you will also have to run make install.

Clone this wiki locally