Cross Compile From Mac using Debian VM

Normally I use DISTCC but it is not great when there are compile errors and the linking process is still done on the RPi

The benefits of the below workflow:

Compile using the RPi as your source disk (no copying back app binaries - single point of OF source)
No Homebrew/Macports/crosstool-ng or fighting with Yosemite
Conceptually should work cross-platform

VirtualBox with Debian VM and cross-compiler
RPi with OF installed/SMB configured with mount point as / and read/write access

Mount Pi and edit OF projects over SMB
SSH into Debian VM to compile
Separate SSH into RPi to run apps


I’m also considering switching my rpi-build-and-boot virtual machine over to SMB. NFS just isn’t getting any less broken over time!

Thanks for the guide @jvcleave! I have followed it almost completely (except that I am using a vagrant box version of Debian 7.3), but am running into an error when trying to compile.

vagrant@vagrant-debian-wheezy-i386:/media/Data/home/pi/openFrameworks/apps/myApps/emptyExample$ make -j6 RPI_TOOLS=$RPI_TOOLS RPI_ROOT=$RPI_ROOT GST_VERSION=1.0 PLATFORM_OS=Linux PLATFORM_ARCH=armv6l
cat: /opt/vc/include/interface/vmcs_host/vc_dispmanx.h: No such file or directory
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa 
../../../libs/openFrameworksCompiled/project/makefileCommon/ *** couldn't find some pkg-config packages, did you run the latest  Stop.

I manually ran the /media/Data/home/pi/openFrameworks/scripts/linux/debian/ script, but that did not fix it. It probably has to do with the absolute paths that you mention in your Troubleshooting part, as find ~/RPI_ROOT/ -name returns /home/vagrant/RPI_ROOT/usr/lib/arm-linux-gnueabihf/ However, I’m unclear as to how to proceed. I checked the folder containing, and it’s packed. Should I remove everything here?



I updated the gist - I was using my existing openFrameworks on the RPi

You will need to run on the RPi - not the Debian VM (although it is probably ok if you did)

After running you will want to run through these copy instructions again

The lines starting with $ mkdir RPI_ROOT to $ cp -Rv /media/Data/opt RPI_ROOT/

@jvcleave Thanks! Just to be sure, I had openFrameworks already working alright on the Pi, I could compile fine there. So should I now run the from the oF/scripts/debian folder on the Pi? Or the debian_armv61 folder?


Hmm - did you do the copy process (starts around line 77 on the gist) - this is your first error

cat: /opt/vc/include/interface/vmcs_host/vc_dispmanx.h: No such file or directory armv6l

This file shouldn’t be effected by the absolute paths (applies mostly to libs)

@jvcleave I did indeed. I just found out the file you mention is not located at the /opt folder, but at ~/RPI_ROOT/opt. Turned out something went wrong with the export commands. I fixed that, and now the first bug is gone, awesome. Now I only get the warning. Do you know which version I should run? Cheers!


What do you get if you run this command from the Debian VM?


for instance mine says


It’s basically working like this

  1. You ran the on the RPI previously if you were able to compile on the RPi
  2. That installed a bunch of packages (cairo zlib gstreamer-app-1.0 etc) into /usr/lib on the RPi
  3. You then copied those over in with these instructions
$ cp -Rv /media/Data/usr/include RPI_ROOT/usr/ 
$ cp -Rv /media/Data/usr/lib RPI_ROOT/usr/
$ cp -Rv /media/Data/usr/share RPI_ROOT/usr/

When make runs it then uses pkg-config to get the info for cairo zlib gstreamer-app-1.0 etc using the paths from the environment variable set in PKG_CONFIG_PATH

Maybe this - add


to the top of


and then try to compile emptyExample

this is my output (I cleaned OF so it would be forced to compile as well)

@jvcleave Thank you, once again!
I have no idea what happened before, but it’s kind of now obvious that something went wrong while setting the environment variables, as the $ echo $PKG_CONFIG_PATH did not return anything. After that I checked the other variables and not a single one was set.
I thought I did set them all before, but obviously something went wrong there, because after setting them again and following the steps after, oF started compiling! (Currently still going on, but so far it seems to work now.) Will update this post after it’s done (or failed).

EDIT: Got really far, but not far enough. It’s stuck on the error below ( cannot find /lib/arm-linux-gnueabihf/ inside /home/vagrant/RPI_ROOT). This file does exist, but the path is incorrect. (File exists at /home/vagrant/RPI_ROOT/usr/lib/arm-linux-gnueabihf/)

long shot but try changing