Crosscompile for elk

Hello!
I just begin to compile/build with juce and projucer.
My first project would be to cross-compile a github vst audio plugin:
Releases · GuitarML/NeuralPi · GitHub
for the elk audio platform
The system I try to compile on is Ubuntu 22.04,
the elk audio systems is an aarch64-elk-linux.
The project has cmake files, which compile without errors on
ubuntu. Also I could run cross-compile a simple hello.c on ubuntu for aarch64
and run it ont the elk system.

But compiling the complex configuration of the plugin (or get projucer
to compile the project) seems hard to me.

Has someone tried to crosscompile with projucer?
Is there any starting tutorial for crosscompilation?

At the moment I have a simple starting problem as well:
projucer shows linux makefile as selected exporter,
but the button to start the compilation is gray.

So my question: how could I start to crosscompile a juce project?
E.g.: is there any projucer template for aarch64 compilation or
a tutorial to crosscompile with projucer??

Thanks for any help!

I cross compiled quite big JUCE projects on Ubuntu for NXP iMX6/8 platforms with Yocto Linux. Generally, setting everything to compile correctly (toolchain, project settings, compiler flags etc.) was a very time consuming trial/error process. I am afraid there is no universal solution here. And you cannot compile directly from Projucer - it’s just a tool to generate JUCE projects which can be compiled externally. On Linux you can try to setup CodeBlocks, but it was so buggy and problematic that I quickly resigned and always compiled everything directly. So, you have your project generated and saved by Projucer, then you need to execute make command for the project. In my case it was needed to make significant changes to the makefiles generated by Projucer (architecture settings etc.)

Anyway, I have no experience in cross-compilation of plugins. I assume it should be no conceptual difference however I don’t expect it is easy :wink:

The best answer is to use CMake. CMake makes it much easier to crosscompile, because you’re not limited to hard-coding options in a jucer file, so you can dynamically override things like compiler selection, system libraries, etc.

Ah, yes! I don’t remember what kind of problems I had with CMake for these projects, but definitely it was due to my limited experience with CMake, so once I established my way to cross-compile with the Projucer generated makefiles, I stopped at that point.

Thank you for your experiences!

I tried to cross compile with cmake.

Is there any good starting point (tutorial/book) on how to use embed juce
into cmake (and how to cross-compile)?

Instead of cross compiling (which may be difficult), you can try building in a Docker container and docker buildx with an image of desired platform.

Thanks for your hints. I tried with docker, but run into problems with libraries for 64 and 32 bits.

So meanwhile I tried to start very basic:

(1) first installed the elk audio sdk:
Releases · elk-audio/elkpi-sdk · GitHub
(2) created a project based on neural pi and its cmakelists.txt
(3) started the elk shell script environment-setup-cortexa72-elk-linux for setting cmake params
(which will be installed by the elk-sdk in /opt/elk(1.0.0 so the command is:
. /opt/elk/1.0.0/environment-setup-cortexa72-elk-linux
(4) created a build directory
(5) started cmake in the build directory:
cmake …

Then there are some error messages, e.g.:
/opt/elk/1.0.0/sysroots/cortexa72-elk-linux/usr/include/bits/timesize.h:23:10:
fatal error: bits/timesize-32.h: No such file or directory
23 | #include <bits/timesize-32.h>
| ^~~~~~~~~~~~~~~~~~~~

In a previous try there were errors like this:

/opt/elk/1.0.0/sysroots/x86_64-pokysdk-linux/usr/libexec/aarch64-elk-linux/gcc/aarch64-elk-linux/11.3.0/ld:
cannot find Scrt1.o: No such file or directory

So to me as someone, who is beginning to try different compilers with c++
it seems. that in the project structure some files are missing.
Could this be the reason for the errors?

Maybe of interest it could also be that Without the command, which calls the elk toolchain, my project compiles and finishes the compile and build process.