alptugan
12/3/2017 - 8:07 PM

Setup Openframeworks on Raspberry Pi 2

Setup Openframeworks on Raspberry Pi 2

Following instructions are hosted on my gist account also. 
I  can compile the polygon and opencv examples successfully after the issues. 
Now everything works fine. Enabling overclock makes compiling  process faster btw.

## Ubuntu Mate Raspberry Pi Setup on RPI-2 board##

1) Download ubuntu RPI image
https://ubuntu-mate.org/raspberry-pi/ubuntu-mate-16.04.2-desktop-armhf-raspberry-pi.img.xz

2) Use Etcher freeware to burn image to SD Card
https://etcher.io/

3) Attach SD Card to rPi, connect keyboard, mouse and display to rPi for the first run and power up RPI

4) Follow the instructions and create user (pi) and password (raspberry)

5) When desktop interface starts, open up Terminal and edit raspi-config to enable following commands;
> sudo raspi-config
- Change Boot Options to the Command Line
- Change Interfacing Options to enable SSH
- Change Memory Split option to 64 M from Advanced Options
- Change GL Driver option to 3rd one to disable GL Driver from Advanced Options
- Save, exit & reboot

6) Login to "pi" user

7) Download nightly build oF arm7 version
> curl -O http://ci.openframeworks.cc/versions/nightly/of_v20170714_linuxarmv7l_nightly.tar.gz


8) Make oF directory
> mkdir of_v20170714_linuxarmv7l_nightly

9) Upack the content into this oF directory
> tar vxfz of_v20170714_linuxarmv7l_nightly.tar.gz -C of_v20170714_linuxarmv7l_nightly --strip-components 1

10) Run dependencies scripts. I get bunch of issues in this section. If you have it also, read the the following fixes and redo the dependencies installation
> cd of_v20170714_linuxarmv7l_nightly/scripts/linux/ubuntu
> sudo ./install_dependencies.sh

**ISSUE 1: When installing dependencies I got error libgl1-mesa-dev-hwe-16.0.4
installing OF dependencies with -hwe-16.04 packages, confirm Y/N ?**

*ref:
https://forum.openframeworks.cc/t/e-unable-to-locate-package-libgl1-mesa-dev-hwe-16-04-and-this-package-doesnt-support-your-platform-probably-you-downloaded-the-wrong-package-ubuntu/26823*
> Just type N to fix this issue 1

**ISSUE 2:
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?**

*ref. & fix: https://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process*
to fix the issue run the following commands; 
> sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
sudo ./install_dependencies.sh

11) If everything goes fine, run codec installation scripts
> sudo ./install_codecs.sh

12) Set your make flags in your .bash_profile
> sudo nano ~/.bash_profile

add the following Line (MAKEFLAGS=-j2 not -j4 because of ISSUE 3 see below)

> export MAKEFLAGS=-j2 PLATFORM_ARCH=armv7l PLATFORM_VARIANT=raspberry2

and Save
>kntrl+o
kntrl+x

13) cd /home/pi/of_v20170714_linuxarmv7l_nightly/examples/graphics/polygonExample
make
**ISSUE 3:
I got the following error;
virtual memory exhausted: Cannot allocate memory**
*ref. & fix:
https://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/*

And recompile again if it fails again then recompile again...I can compile the example at the 2nd try