Juce Raspberry PI

ok, thx for clarifying

I just successfully built a simple Juce-based command line tool on a Raspberry Pi 3. I did this with a normal Linux Makefile exporter and wanted to set the Architecture flag there to ARM v8 as the RPi 3 has a 64 Bit ARM v8 CPU, however, there is just an ARM v6 and an ARM v7 option. Is there any reason for that? What settings are recommended?

All works amazingly well on Ubuntu, but I have to remove clang from the make command in terminal and from any install script(a script nicely provided by a JUCE user). Am i correct in assuming not using clang does not matter?
I am using terminal make to build projects. I have not had any luck with code blocks(terminal is ok as I design on a mac first). Any hints for setting up codeblocks on raspberry pi linux? I have codeblocks installed, but it is not building the JUCE projects.
In the JUCE demo internet is not working for me or in firefox(works in Chrome) since installing the suggested dependencies. Any further thoughts?
Almost finished building my first DAC from scratch. I would have only dreamt about this a couple of years ago.
Thanks JUCE

1 Like

I don’t think there’s a reason for that, other than it’s not been updated for a while. Is the required flag -march=armv8 ?

It shouldn’t matter which compiler you use out of of clang and gcc.

What errors are you seeing when attempting to compile with Code::Blocks? If you don’t give us any more information we’re going to struggle to work out what’s going wrong!

Try putting JUCE_USE_CURL=1 in the preprocessor definitions in the Projucer. cURL is much more robust than JUCE’s inbuilt networking.

We’re trying to use JUCE on Raspberry Pi with a Raspbian distro. Everything compiles and works fine except OpenGL. Our app uses the OpenGL renderer for both 3D and UI rendering with an attached OpenGLContext to the top level component.

When Raspberry emulates GL on the CPU everything works, but (not surprisingly) terribly slow. When hardware acceleration is enabled we can see a few frames to render and after that the app just stops responding. You can check it with the JuceDemo too, it’s the same behaviour.

When we run the GLX Gears demo (one of the default MESA tests) it runs on stable 60 FPS forever.

Any tips on this? Thank you!

Anyone doing some cross-compiling?
I really wished I could compile from Xcode directly or even with cmake but from my main machine.
Seems most of what I’ve found is based on Qt for those who like using IDE.

P.S. - Raspbian is 32-bit and from all I’ve read for audio Ubuntu Mate is one of the most fitted performance wise.

Hi Tom,
Thanks for the JUCE_USE_CURL=1 preprocessor definitions tip. The web browser now works like a charm.
The first basic question is does the JUCE demo in Projucer set up code blocks or do I have to manually change things like the compiler setting in code blocks to arm, etc? The error I am getting in code blocks is

  • g++ error unrecognized command line option nstackrealign
    Thanks so much

I think it should be -march=armv8-a

What happens if you remove -mstackrealign from the compiler configuration in Code::Blocks? Are you then free from errors? If not, what compiler are you using? Can you compile using the Makefile?

I’m not sure why that flag is there - we don’t add it to the Makefiles, so I don’t think we should be adding it to the Code::Blocks project.

Actually, if you’re going for performance, it looks like you probably want all of

CFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -ftree-vectorize".

1 Like

Thanks Tom
All that info is fantastic.
I am compiling using makefile. It works well.

Hello guys, is there a guide to do cross-compiling?
I tried to compile in a RPi1 (0.5GB Ram), but it is impossible, it get

virtual memory exhausted: Cannot allocate memory

after 7h, when it tries to

Compiling include_juce_gui_basics.cpp

similar to this

The weird is I create a console project to test, but it still tries to compile it.
Why does a Console project need to compile a GUI Basics module?
And I use JUCE_USE_XSHM=0 JUCE_USE_XINERAMA=0 in Linux Makefile->Extra Preprocessor Definitions.
Note: I am using the last source code.
Are there some Flags to put in somewhere to “Fix” this?

I have try many ways to accomplish a cross compile method, two of them that I could put to work successfully are dockcross (a docker image, fast to get working, “harder” to customize) and crosstool-NG (slow to build, but easy to customize).

The first lesson I learned in the process is: It is important to match the libc and binutils with the system (raspbian in my case) and the gcc with the two aforementioned.

To build a project, such as a Juce project that require some dependencies, and they require some others dependencies, it becomes a messy.
I was thinking to do a trick, to get all dependencies in the sysroot of the cross-compile toolchain, just install them in the raspbian (in the Pi) and then to copy to the sysroot (cross-toolchain) in my AMD64 machine.

My goal is to compile an Audio App, and if It can be done with cross-compiling, will be great.


You know that you can enable or disable the single modules in the modules tab in the projucer? I think the console app has the GUI module added by default, you could try removing everything but the core module for a first try.

When it comes to cross compiling for ARM, at least for simple projects, it is very straightforward to cross compile from a Linux machine for an ARM. I currently do this a lot with JUCE based projects and CLion and all I have to change to get it working is to choose the arm-linux-gnueabihf-g++ as the compiler in my CLion toolchain. I would give it a try with getting an arm-linux-gnueabihf-g++ from your package manager and then calling your JUCE-generated Makefile with make CXX=arm-linux-gnueabihf-g++


I found I could compile on the Pi once I setup a decent amount of Virtual Memory on an external SSD. Compiling on the internal SDCard was pretty slow. Better to add an external SSD.

Can you compile in a VM?

Where do you get your toolchain?
I build a custom from crosstool-NG, and they work well.
When I build a juice project It doesn’t found X11 Webkit… and others dependencies.
How do you get all dependencies available to the toolchain?
What flags do you use in Projucer (Makefile)?

I build my gcc toolchain along with my rootfilesystem with buildroot, where I select all the dependencies I need. It takes about 50 minutes to build but then it all simply just works in my case, I invoke the g++ from the buildroot output directory, build my juce project with it and run it on my ARM. However, as my ARM does not have any GUI, I never needed to set up those dependencies.


Thanks Janos, I’m going to check buildroot.
Do you have tips/guide to setting up?
This Cross Compiling ROS Project for ARM may help.

1 Like

As I’m working with Intel FPGAs I took my information from a source discussing the special process when building a Linux for these from scratch - you find it here. Not everything discussed there will be interesting for you, however the section on buildroot is quite good in my opinion. However in the tutorial they use an existing toolchain while I decided to let buildroot build my custom toolchain for various reasons (mostly because a library I need depends on a quite old linux kernel version but I needed C++17 support and there was no toolchain available out of the box supporting both)