# Juce on the Raspberry Pi & OpenGL?

**URL:** <https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921>\
**Category:** General JUCE discussion\
**Created:** [February 3, 2013, 4:26pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921 "2013-02-03T16:26:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugh](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@hugh](https://forum.juce.com/u/hugh)\
**Post date:** [February 3, 2013, 4:26pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/1 "2013-02-03T16:26:55Z")

</div>

Hi Everyone,

I’ve been compiling some Juce projects for the Raspberry Pi.

Juce apps will compile under Raspbian as follows:

(1) get the following updates (thanks to the thread that posted this list!)

`sudo apt-get -y install libfreetype6-dev
sudo apt-get -y install libx11-dev
sudo apt-get -y install libxinerama-dev
sudo apt-get -y install libxcursor-dev
sudo apt-get -y install mesa-common-dev
sudo apt-get -y install libasound2-dev
sudo apt-get -y install freeglut3-dev
sudo apt-get -y install libxcomposite-dev
sudo apt-get -y install libjack-dev`

(2) Have Introjucer generate the Linux target

(3) change the linux Makefile to say

```auto

```

[NB: can also change the CONFIG to Release default here]

(4) JuceLibraryCode/AppConfig.h

```auto

```

(5) modules/juce\_gui\_basics/juce\_gui\_basics.h

```auto

```

(steps 4 & 5 might not be necessary).

Ok, so my question is; does anyone have any idea if OpenGL ES 2.0 can be made to work. Apparently, there is/was a problem using OpenGL under X on the PI - is this still true or is it fixed?

mysteriously my OGL program links with the generated makefile. it crashes though! The default makefile doesn’t link with any GL libs. This seems a mystery to me. should I be static linking to OGL, or is there no chance of it working?

any ideas.  
– hugh.

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 9, 2013, 7:04am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/2 "2013-04-09T07:04:21Z")

</div>

I am working on a Python API to OpenGL ES 2.0 called [pi3d](https://github.com/tipam/pi3d) and we’re getting that library to work from Python, so I know it is possible.

Thanks for this excellent information about how to compile Juce on the RP, I’m really psyched to do some work for it…!

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 10, 2013, 5:09am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/3 "2013-04-10T05:09:23Z")

</div>

Just a followup - I wrote a simple little Juce program on the Mac, compiled it onto the Raspberry Pi using your instructions - and it worked right the first time!

It’d be love to have some “subswitch” someone in the Introjucer so I didn’t have to keep making those last few edits every time I updated, but I’d still say I’m “extremely satisfied” with the results.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 10, 2013, 7:19am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/4 "2013-04-10T07:19:05Z")

</div>

Cool stuff. You know that in at the top of the AppConfig.h file there’s a “user code” section where you can put #defines like this, and the introjucer won’t overwrite them?

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 10, 2013, 7:55am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/5 "2013-04-10T07:55:17Z")

</div>

So then it’s just that -march=armv6 flag…!

---

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [April 10, 2013, 1:09pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/6 "2013-04-10T13:09:10Z")

</div>

> [@](#):
>
> So then it’s just that -march=armv6 flag…!

Like [this](https://github.com/jrlanglois/JUCE/commit/f053fe33252a658495c58a969555ebab15d58757), perhaps?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 10, 2013, 7:57pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/7 "2013-04-10T19:57:39Z")

</div>

That looks like a good mod. Perhaps with a v7 as well?

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 10, 2013, 8:17pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/8 "2013-04-10T20:17:02Z")

</div>



---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 21, 2013, 7:07pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/9 "2013-04-21T19:07:42Z")

</div>

I note with pleasure that you have in fact added support for ARM v6 and ARM v7 to the Introjucer. I’m going to rebuild all my Juce stuff from scratch with this new mod, and see if I can in fact get to an executable without any tweaking (my theory - absolutely), and if so, make an announcement on the Juce boards.

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 21, 2013, 8:49pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/10 "2013-04-21T20:49:22Z")

</div>

So it almost works. 😃

The Makefile is basically correct - it does create the right flags but then it overrides them [here](https://github.com/rec/echomesh/blob/ca2cf2b087b4d43e4ea6cd43d0e731748dc8641f/code/cpp/echomesh/Builds/Linux/Makefile#L8). If you comment those three lines out, the build seems to move forward… or even just invoke make as

```auto

```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 22, 2013, 10:26am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/11 "2013-04-22T10:26:59Z")

</div>

Ok, I’ve rearranged the makefile a bit - try again now…

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 22, 2013, 6:45pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/12 "2013-04-22T18:45:15Z")

</div>

On it!

While I’m doing that, take a look at [this document](https://github.com/rec/echomesh/blob/master/documentation/Building%20Juce%20applications%20on%20the%20Raspberry%20Pi.md) describing the build process. (I’ll change the “make” command as soon as I’ve tested it.)

Is this good? I’ll send it out to the usual places, if so…

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 22, 2013, 9:20pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/13 "2013-04-22T21:20:16Z")

</div>

It now works perfectly, and I updated [the document](https://github.com/rec/echomesh/blob/master/documentation/Building%20Juce%20applications%20on%20the%20Raspberry%20Pi.md) to reflect that you can just type “make”.

---

<div class="post-metadata">

**Author:** ![jordanh](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@jordanh](https://forum.juce.com/u/jordanh)\
**Post date:** [April 23, 2013, 6:33am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/14 "2013-04-23T06:33:05Z")

</div>

This is great, have an untouched Pi so will definitely try this out. Do you guys recommend the Getting Started pdf on [raspberrypi.org](http://raspberrypi.org) for OS install and whatnot? Favourite Pi baking tips welcome 🙂

---

<div class="post-metadata">

**Author:** ![tomswirly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/tomswirly/32/236_2.png) [@tomswirly](https://forum.juce.com/u/tomswirly)\
**Post date:** [April 23, 2013, 7:27am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/15 "2013-04-23T07:27:05Z")

</div>

I just installed Raspbian and it all seemed to work out of the box.

Don’t forget to apt-get update and apt-get upgrade…! In fact, [here’s](https://github.com/rec/echomesh/blob/master/code/bash/upgrade.sh) a script to update, upgrade and update your firmware…

---

<div class="post-metadata">

**Author:** ![ShareCommunity](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/sharecommunity/32/1748_2.png) [@ShareCommunity](https://forum.juce.com/u/ShareCommunity)\
**Post date:** [October 11, 2014, 3:01am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/16 "2014-10-11T03:01:20Z")

</div>

Yippee! (ish)

I recently upgraded&nbsp; / updated my Pi's OS ( **sudo apt-get dist-upgrade** ) and fetched the latest firmware ( **sudo rpi-update** )

I went through each .jucer configuration&nbsp; Linux Makefile-\>Extra Preprocessor Definitions adding **JUCE\_USE\_XINERAMA=0** &nbsp; and setting _module Juce\_gui\_basics_ **JUCE\_USE\_XSHM** to **Disabled**

Rebuilt all of the Juce extras projects (both release and debug, just in case)

{details elsewhere on this forum&nbsp;http://www.juce.com/forum/topic/list-juce-dependancies-under-ubuntu-linux about developing for the pi (I'm using Raspbian&nbsp;http://www.raspbian.org/ rather than anything else )&nbsp; and about exports &nbsp;http://www.juce.com/comment/289404#comment-289404 I use } - The build took a while (6-8hrs! with and un-overclocked pi with an 8GB Class 10 SD card )

Then, I made a really fresh pot of tea, and tried it all out ;)

Audio demos (which used to work), now fail :( TBH, when they worked in the past everything was ridiculously slow (and things seemed to report lots of (32) audio chanels!) - but OpenGL demos (which used to fail), now work, albeit v.e.r.y....s.l.o.w.l.y, but flawlessly. Using the frame-count texture, it was clear that screen refresh is the problem (counts jump by the 100's!)&nbsp; I suspect the audio and graphic slowness are related, but I can't think of way to narrow-down the causes.

I've seen Minecraft running much more rapidly/smoothly, and if I had to guess, I think there's something stll not quite right going on. ).

_I found if I left JUCE\_USE\_XSHM as default & JUCE\_USE\_XINERAMA=1, the things only worked via VNC (YMMD / OpenGL demos still fail under VNC)_

Still, pretty amazing stuff.&nbsp;

&nbsp;

Thanks, Jules (and all who contributed) for some stirling work!

&nbsp;

---

<div class="post-metadata">

**Author:** ![martinrobinson-2](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/martinrobinson-2/32/630_2.png) [@martinrobinson-2](https://forum.juce.com/u/martinrobinson-2)\
**Post date:** [February 8, 2015, 10:45am UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/17 "2015-02-08T10:45:27Z")

</div>

Just trying out Juce on my RPi (I have one of the original Model Bs). These instructions no longer work out of the box. You need to update to g++4.7 for C++11 support:

http://www.raspberrypi.org/forums/viewtopic.php?f=33&t=22938

And I kept getting this error on 'make' with the default arch setting (native) or specifically arm6:

```
error: target CPU does not support ARM mode
```

I just removed these lines from the makefile in both the Debug and Release sections:

```
ifeq ($(TARGET_ARCH),)
    TARGET_ARCH := -march=native
  endif
```

Not sure what a better alternative is.

&nbsp;

---

<div class="post-metadata">

**Author:** ![samuel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/samuel/32/21_2.png) [@samuel](https://forum.juce.com/u/samuel)\
**Post date:** [February 8, 2015, 1:19pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/18 "2015-02-08T13:19:32Z")

</div>

Hi Martin et all,

these are my current notes regarding JUCE on a Raspberry Pi B+. I don't need to modify the JUCE Makefile.

> .. author: Samuel Gaehwiler (klangfreund.com)
> 
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> Raspberry Pi B+  
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
> 
> On OSX  
> ======
> 
> If you intend to work with the Cirrus Logic Audio Card, download the Raspbian Image from  
> http://www.element14.com/community/community/raspberry-pi/raspberry-pi-accessories/cirrus\_logic\_audio\_card -\> Firmware Download.
> 
> Format the microSD card using the SDFormatter https://www.sdcard.org/downloads/formatter\_4/ .  
> Choose "Quick Format".  
> Call the Card "RECOVERY" (It would be renamed to this from the Raspberry Pi anyways).  
> (Source: http://www.raspberrypi.org/help/noobs-setup/)
> 
> Ensure that disk4 really corresponds to the microSD card::  
> &nbsp;&nbsp;&nbsp; diskutil info /Volumes/RECOVERY/
> 
> In Disk Utility, unmount the RECOVERY disk. (don't eject in Finder.)
> 
> Copy the img (7.34GB) to the microSD card::  
> &nbsp;&nbsp;&nbsp; sudo dd bs=1m if=cirrus\_audio.img of=/dev/disk4  
> (Source: http://www.instantsupportsite.com/self-help/raspberry-pi/raspberry-p-wheezy-installation/)  
> bs = blocksize  
> This took 3112 seconds to complete... (next time, check if dd has a -v / --verbose flag)
> 
> &nbsp;
> 
> On the Raspberry Pi  
> ===================  
>   
> Blank Screen  
> ------------
> 
> If your display remains blank, you should select the correct output mode for your display by pressing one of the following number keys on your keyboard:  
> 1. HDMI mode - this is the default display mode.  
> 2. HDMI safe mode - select this mode if you are using the HDMI connector and cannot see anything on screen when the Pi has booted.  
> 3. Composite PAL mode - select either this mode or composite NTSC mode if you are using the composite RCA video connector.  
> 4. Composite NTSC mode  
> (Source: INSTRUCTIONS-README.txt)
> 
> What did it for me: Reset the display.
> 
> Dvorak keyboard layout  
> ----------------------
> 
> sudo dpkg-reconfigure keyboard-configuration
> 
> Choose the generic keyboard
> 
> Choose Dvorak (international with dead keys)
> 
> Reboot
> 
> (Source: http://www.raspberrypi.org/forums/viewtopic.php?f=27&t=12860 )
> 
> Essentials  
> ----------
> 
> sudo apt-get install vim
> 
> &nbsp;
> 
> JUCE  
> ====
> 
> Get JUCE  
> --------
> 
> git clone --depth 1 git://github.com/julianstorer/JUCE.git
> 
> Dependencies needed by JUCE  
> ---------------------------
> 
> sudo apt-get -y install g++ libfreetype6-dev libx11-dev libxinerama-dev libxcursor-dev mesa-common-dev libasound2-dev freeglut3-dev libxcomposite-dev libjack-dev
> 
> Ugrade g++ to support C++11  
> ---------------------------
> 
> # Upgrade g++  
> sudo apt-get install gcc-4.7 g++-4.7  
> sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6  
> sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
> 
> sudo update-alternatives --config gcc  
> # and choose gcc-4.7 as default
> 
> Modify the JuceLibraryCode/AppConfig.h  
> --------------------------------------
> 
> #define JUCE\_USE\_XSHM 0  
> #define JUCE\_USE\_XINERAMA 0
> 
> Sources:  
> http://www.juce.com/forum/topic/juce-raspberry-pi-opengl  
> https://github.com/rec/echomesh/blob/master/documentation/Building%20Juce%20applications%20on%20the%20Raspberry%20Pi.md
> 
> Build  
> -----  
> ::  
> &nbsp;&nbsp;&nbsp; make CONFIG=Release

---

<div class="post-metadata">

**Author:** ![martinrobinson-2](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/martinrobinson-2/32/630_2.png) [@martinrobinson-2](https://forum.juce.com/u/martinrobinson-2)\
**Post date:** [February 8, 2015, 6:09pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/19 "2015-02-08T18:09:15Z")

</div>

Thanks, I guess the architecture error I was getting was an error from gcc \< 4.7.

Working great now.

---

<div class="post-metadata">

**Author:** ![adamvietnam](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@adamvietnam](https://forum.juce.com/u/adamvietnam)\
**Post date:** [February 27, 2015, 1:21pm UTC](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921/20 "2015-02-27T13:21:22Z")

</div>

Following the above steps on Raspberry PI 2 , when I do:

make CONFIG=Release

I get a scary:

Compiling Main.cpp

\*\*\* glibc detected \*\*\* g++: double free or corruption (top): 0x00e44418 \*\*\*  
Aborted  
Makefile:129: recipe for target 'build/intermediate/Release/Main\_90ebc5c2.o' failed  
make: \*\*\* [build/intermediate/Release/Main\_90ebc5c2.o] Error 134

I tried wiping the PI and starting again and reinstalling Raspbian but do joy

Any ideas what I'm doing wrong?

&nbsp;

&nbsp;

[Next page](https://forum.juce.com/t/juce-on-the-raspberry-pi-opengl/9921.md?page=2)
