Juce Raspberry PI

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.

Regards!

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++

3 Likes

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?
https://www.osboxes.org/raspbian/
or

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.

2 Likes

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)

if it’s cpp files, it has to use gcc in the end