Raspberry Pi 2 Setup Guide (0.8.4)

Edit: 0.9.0+ has now been released. Please follow the standard Raspberry Pi setup guide on the download page for 0.9.0+ (for 0.8.4 keep reading below …)

Hello all, I finally got a Raspberry Pi 2 and wanted to post a quick how-to. Since Raspberry Pi 2 uses the armv7 architecture, there are a few extra (but simple) steps to getting the latest release of openFrameworks (0.8.4) working. This is a followup to another thread here.

  1. Begin by installing the latest Raspbian Image on your SD card.
  2. Plug the Raspberry Pi 2 into into an ethernet connection, HDMI monitor, keyboard and mouse. Then plug it in to power (if you must use wifi see the comment below).
  3. Assuming this is your first time starting with the fresh Raspbian image from step 1, make the initial Raspbian configurations. If it isn’t your first time, you can get back to the Raspbian configuration screen by calling sudo raspi-config). We recommend that you configure the following:
  • Expand the file system.
  • Change User Password
  • Set your preferred internationali(s/z)ation preferences (this is particularly important if you are not using a British English keyboard).
  1. Reboot the Raspberry Pi 2. If it doesn’t happen automatically, call sudo reboot.
  2. Once rebooted, log in with username pi and password raspberry (unless you changed it above).
  3. On the Raspberry Pi 2 command line, download the OF 0.8.4 linuxarmv7 distribution. Note this is the linux armv7 distribution, NOT the linux armv6 (which is what you would use for any Raspberry Pi before version 2).
  • cd ~
  • curl -O http://www.openframeworks.cc/versions/v0.8.4/of_v0.8.4_linuxarmv7l_release.tar.gz
  1. Unpack the release:
  • cd ~
  • tar xvf of_v0.8.4_linuxarmv7l_release.tar.gz
  1. Add the updated Raspberry Pi 2 makefiles to the release:
  • cd ~
  • curl https://raw.githubusercontent.com/openframeworks/openFrameworks/master/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.default.mk -o of_v0.8.4_linuxarmv7l_release/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.rpi2.mk
  1. Install the linux dependencies:
  • cd ~/of_v0.8.4_linuxarmv7l_release/scripts/linux/debian/
  • sudo ./install_dependencies.sh
  1. Set an environmental variable. This must be done before using the makefile system each time you enter a new terminal or restart the Raspberry Pi 2. It can be automated by adding it to the end of your bash init script (e.g. your bash ~/.profile file). The following tells the make system to use all 4 cores for compiling and to use the Raspberry Pi 2 variant of the armv7 makefiles (you manually added it in step 8).
  1. Compile an example:
  • cd ~/of_v0.8.4_linuxarmv7l_release/examples/3d/3DPrimitivesExample/
  • make
  1. Run the example:
  • make run.

Have fun!


This worked perfectly for me with a few modifications because I was using wifi - and wanted to use SSH so that I could quickly cut and paste some of the longer commands. For newbies here is how to do that:

Enable SSH in the advanced settings of the configuration screen.

To setup WIFI type startx on the commandline. This will start the gui. To to preferences ‘wifi configuration’ and scan for networks. You will need to select your network and enter the password in the PSK field. It will display a connected status once you are online.

To exit the gui select the shutdown option and choose logout. This will put you back on the commandline. Type ifconfig to get your IP address. It will be under “wlan0” if you are using WIFI after “inet addr:”.

Assuming your PC is on the same wifi network as your Pi, you can now SSH into the terminal by typing this on your PC commandline ssh pi@xx.x.x.xx (substitute your IP address) and enter the password.

1 Like

Worked like a charm. Thanks for the guide!

1 Like

super sweet. My pi2 is “On Fedex truck for delivery.” I’ll update rpi-build-and-boot this week.

I don’t care how fast that new processor is. I’m still cross-compiling :smile:

1 Like

Works well, thanks!

I think this is a problem with the release of armv7 with opencv
but follow this and copy the precompiled files from post 4:

*sorry for no link, new users can not put any in, grrr

1 Like

I keep running into an error when I try to compile an example. I’m not sure where the error starts, so here is the output from the earliest place I think it starts:

g++ -O3 -Wall -march=armv7-a -mfpu=vfp -mfloat-abi=hard -fPIC -ftree-vectorize -Wno-psabi -pipe -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -DTARGET_RASPBERRY_PI -DSTANDALONE -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -DUSE_DISPMANX_TRANSFORM_T -I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -pthread -D_REENTRANT -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gstreamer-1.0 -I/usr/include/alsa -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/harfbuzz -I../../../libs/fmodex/include -I../../../libs/glfw/include -I../../../libs/glfw/include/GLFW -I../../../libs/kiss/include -I../../../libs/openssl/include -I../../../libs/openssl/include/openssl -I../../../libs/poco/include -I../../../libs/rtAudio/include -I../../../libs/tess2/include -I../../../libs/openFrameworks -I../../../libs/openFrameworks/math -I../../../libs/openFrameworks/utils -I../../../libs/openFrameworks/gl -I../../../libs/openFrameworks/communication -I../../../libs/openFrameworks/events -I../../../libs/openFrameworks/graphics -I../../../libs/openFrameworks/3d -I../../../libs/openFrameworks/sound -I../../../libs/openFrameworks/types -I../../../libs/openFrameworks/video -I../../../libs/openFrameworks/app  -MMD -MP -MF ../../../libs/openFrameworksCompiled/lib/linuxarmv7l/obj/Release/libs/openFrameworks/math/ofQuaternion.d -MT../../../libs/openFrameworksCompiled/lib/linuxarmv7l/obj/Release/libs/openFrameworks/math/ofQuaternion.o -o ../../../libs/openFrameworksCompiled/lib/linuxarmv7l/obj/Release/libs/openFrameworks/math/ofQuaternion.o -c ../../../libs/openFrameworks/math/ofQuaternion.cpp
make[2]: g++: Command not found
makefileCommon/compile.core.mk:228: recipe for target '../../../libs/openFrameworksCompiled/lib/linuxarmv7l/obj/Release/libs/openFrameworks/math/ofQuaternion.o' failed
make[2]: *** [../../../libs/openFrameworksCompiled/lib/linuxarmv7l/obj/Release/libs/openFrameworks/math/ofQuaternion.o] Error 127
makefileCommon/compile.core.mk:199: recipe for target 'Release' failed
make[1]: *** [Release] Error 2
make[1]: Leaving directory '/home/pi/of_v0.8.4_linuxarmv7l_release/libs/openFrameworksCompiled/project'
../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:126: recipe for target 'Release' failed
make: *** [Release] Error 2

I’m grateful for any pointers. Thanks!

g++: Command not found seems like the key – perhaps try running step 9 again to make sure everything is in the right place?

I erased all the oF-related directories and re-followed the instructions. I even copied and pasted into the terminal to avoid typos, but I’m still getting the same errors. Could this be a problem with my SD card?

If you type g++ at the command line, what does it say? Are you working directly on the Pi, or are you using SSH?

I had been using ssh, but I just tried it on the pi directly and I got the same error. And when I tried g++ in the command line I got -bash: g++: command not found

strange as I am pretty sure Raspbian ships with gcc/g++ 4.6

to install it do

$ sudo apt-get install g++

awesome. worked flawlessly - thanks! the compile is so much faster now: took about 20 minutes, as opposed to ~45 minutes previously.

next step: get the cross compile to work. :slight_smile: my understanding is that the existing compiler should work, but it would be nice to be able to add in the options for the newer chip (at the cost of not being backwards compatible). will experiment and see!

Dunno which sdcard you’re using, but with my brand new PI 2 I use a class 10 card, and the PI2 is overclocked to 1Ghz : compiling OF took far less than 20 minutes, I don’t remember precisely how much time, but it seemed very fast to me… (may be less than 10 minutes).

About the sdcard : it cutted down the boot time by 30% - And epiphany became usable which is wasn’t with the old Class4 sdcard…

Just did a recompile bench
cd openFrameworksCompiled/libs
rm -rf *
make Release -C /home/pi/openFrameworks/libs/openFrameworksCompiled/project

4:12 !!! (4 minutes and 12 seconds)

make Debug -C /home/pi/openFrameworks/libs/openFrameworksCompiled/project

2:35 !!! (2 minutes and 35 seconds)

This seem very low but I wandered in the source tree, I don’t see nothing that would be left compiled from the previous compilation…

Of course, with multithreaded/multicore make option -J4

You can make it persistent by adding those two lines to your “/etc/environment” file


hmm interesting. second time, i get this:

real 3m33.067s
user 11m57.880s

thats a huge difference between the real/user values.

using a class 4 card, as my class 10 ones (ADATA branded) happen to be non-compatible with the RPi2 (works fine with the B+ band B models, just not the new one).

That’s funny because on my PI2, the 4:08 real time elapsed is reported as :
real 4m8.668s
user 15m24.500s
sys 0m27.750s

Is there anything I’m missing with time’s report ??

I tried reinstalling g++, but it said that it was up to date. After a while, I just decided to re-flash the sd card and start over with a completely clean slate. At first, I was getting an error similar to the one that started this thread, but after some head scratching, I rebooted and the 3dPrimitivesExample now compiles and runs. Thanks for your help, everyone!

ahh… after looking at it a bit further, the user time is basically the total amount of processing time, which due to the 4 cores being used, is roughly 4x the “real” time. so that seems to make sense. it shows the compilation is making full use of all the cores!

I’m wondering if it’s possible to have one OF folder that works with both Pi1&2? Maybe somehow make use of github master version instead of v0.8.4 release?