HOWTO: cross-compile for raspberry pi on Ubuntu 12.04

I had a great deal of trouble making this work, so I’m posting this here. So I don’t forget how to do it.

Tested for my setup:

  • Ubuntu 12.04 32-bit
  • 2014-01-07-wheezy-raspbian
  • OpenFrameworks 0.8 (release)
  • My Pi is NFS booting from the Ubuntu box, FWIW.

Follow the directions from the Raspberry Pi cross-compiling guide on the oF site (but see below)
There are two errors in the cross-compiling guide:

  • The correct command to build is make -j6 RPI_TOOLS=$RPI_TOOLS RPI_ROOT=$RPI_ROOT GST_VERSION=1.0 PLATFORM_OS=Linux PLATFORM_ARCH=armv6l (the difference is in the GST_VERSION)
  • the $RPI_ROOT directory should be set to a directory that contains the raspberry pi /usr, not the /usr directory itself.

You will get PKG_CONFIG errors. To fix them:

export PKG_CONFIG_PATH=$RPI_ROOT/usr/lib/arm-linux-gnueabihf/pkgconfig:$RPI_ROOT/usr/share/pkgconfig:$RPI_ROOT/usr/lib/pkgconfig

You may get errors related to libdl when linking (depending on how you’re accessing $RPI_ROOT). There are some absolute symlinks in your $RPI_ROOT that are broken. Fix them with this script. Change the first line to #!/bin/bash.

1 Like

Thanks for this!

Is there any way you could put your fixes in the guide? If you have a github account you should be able to edit it here

Thanks for this tutorial!

To fix linking error

  • download fixQualifiedLibraryPaths in 1st post (this).

  • in terminal
    sudo ./fixQualifiedLibraryPaths $RPI_ROOT $RPI_TOOLS/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++

Hello,

Impossible for me to find fixQualifiedLibraryPaths or the folder “cross-compile-tools” like described here : http://wiki.qt.io/RaspberryPi_Beginners_Guide

Someone could give us a link ?

Thanks

Here is my version of it - it’s been a while so I can’t recall if I modified any of it
https://gist.githubusercontent.com/jvcleave/8489b3ec5897eb1a26a2/raw/9997b79ba082a47466c4e08eea72df4283434d80/fixQualifiedLibraryPaths.sh

It was part of this process

XDAQ ecosystem includes oF with Eclipse over Debian/Ubuntu, and a lot of powerful scientific tools.