Guides/Tutorials for Juce + Linux + Codeblocks or Makefile

Hey all, curious if anyone has any recommendations for some simple straightforward tutorials or guides to properly setting up Juce with Codeblocks on Linux, or how to develop with Makefiles.
.
.

The short:
Normally a Mac/XCode person. Trying to do something for Linux inside a virtualbox on my Mac. Codeblocks builds keep failing, often seemingly because of missing dependencies that i’ve installed, but maybe other reasons. (However, they build on my RasPi. It just takes forever for them to build.)

Would love a link to a proper one-stop-guide to setting up Juce + Codeblocks + Linux to see if i’m missing anything or doing things wrong, if such a guide exists.
.
.
.

The long version:
I’m normally on Mac/XCode but i’m working on a project for my Raspberry Pi. I’ve made a few test Juce apps in XCode, transferred to the Pi, added the Codeblocks exporter, and built. A Juce app that just does square wave sweeps builds and works successfully, but it takes almost 10 minutes to build with CodeBlocks on the Pi (Raspberry Pi OS Lite + OpenBox). Also, i need to start working on some linux-specific things, so finishing the project in XCode and then building the finished project on the Pi won’t work.

So, i’m trying to finish developing this project on a Linux distro in a VirtualBox on my Mac. But, even Juce’s Hello World won’t build.

I installed all the Juce Dependencies listed here. So far I’ve tried Debian and Pop_OS! in VirtualBox. (Debian with Raspberry Pi Desktop is next). I’ve tried installing Codeblocks via apt, synaptic, the Pop Store, and from source. On both Distros, on all the install methods, Juce builds fail for different reasons. I can create a new command line project in Codeblocks and build basic “Hello World” apps with basic std::cin and stc::cout commands, like getting and adding 2 numbers in my different Codeblocks installs.

Sometimes they seem to be failing because a dependency that is installed can’t be found. For instance, it was looking for <gtk/gtk.h>, and the Juce code said something like, “if this can’t be found install webkit(something)-4.0” But, i checked and that’s installed. And i went in and installed webkit* just in case. Still doesn’t work.

I don’t necessarily want anyone to hold my hand through the convoluted setup process. But, because it’s so fractured, with so many moving pieces, and so many alternative install methods, each with their own separate tutorial/install guide, I would love if someone could point me to a guide in one place that says “To get Juce + Codeblocks working on Linux, do X, Y, Z…” (If it exists. I haven’t found it.)

I assume i’m missing a vital step or doing something wrong, but have no idea how to figure out what.

Without any concrete outputs it will be difficult to help you. Which version of juce do you use? I’m not sure if juce 6 has a exporter for code:blocks any more. Can you build your project only with “make”? But as said : please provide compiler output.

I’m less looking for someone to tell me what is wrong and more looking for a guide to make sure i’m setting up and doing everything correctly.

I’ll run through my different build attempts to grab the compiler outputs if you want. But like i said, i’m less looking for “fix the problem for me” and more “how can i figure out how to fix the problem.” Compiler outputs might help you fix the problem for me, but a guide to set it up properly might save you all the trouble. :wink:

Latest version of Juce. Clean installs of the OSes on the virtualboxes. Codeblocks version depends on the install method and location: Version 17.x on the Pi from apt. Version 20.x and 17.x on the VMs.

I deleted my Debian VM already. If i remember that was building, but the app not running. When i tried to run the app in the command line i was getting segmentation faults.

make also failed on PopOS when i ran it earlier.

I’ll go through the different builds for my Pop_OS! VM, and see what comes up when i’m done installing and testing Debian w/Raspberry Pi Desktop VM and report back.

After a couple different distros and installs of dependencies/Juce/Codeblocks on the different systems, i finally got the Juce “Hello World” app to build and run on Linux.

  • Installed a fresh latest Ubuntu LTS on a virtuabox. (Wanted a Debian based system because the ultimate goal is a Raspberry Pi running the latest Rasbian Lite and the Juce Github said they tested the dependencies on Ubuntu systems)
  • Installed all the dependencies listed here on the Juce Github.
  • Built Projucer using make CXX=clang++
  • Installed Code::Blocks using apt install codeblocks
  • Still got the a bunch of the the same build issues (Building with Clang, not g++)
  • Wondered why Juce Apps will build in CodeBlocks on my Raspberry Pi but not a “regular” non-ARM install of Linux.
  • Tracked down the libraries i used for my RasPi. Saw that ladspa-sdk wasn’t listed in the Juce Github but was on my RasPi dependency list, so I installed it also.
  • Build and Run (Clang) the Shared Code to get the .a file (success)
  • Build and Run (Clang) the Debug Standalone (success)
  • Ran the juce app: ./juceAppName “Hello World” (success)

The issue i was running into on build was this Build Message:

||=== Build: Shared Code | Debug in test1 (compiler: LLVM Clang Compiler) ===|
/home/noise/JUCE/modules/juce_gui_extra/juce_gui_extra.cpp|121|fatal error: 'gtk/gtk.h' file not found|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

Build Log:

-------------- Build: Shared Code | Debug in test1 (compiler: LLVM Clang Compiler)---------------

clang++ -Wall -Wno-strict-aliasing -Wno-strict-overflow -DLINUX="1" -DDEBUG="1" -D_DEBUG="1" -DJUCER_CODEBLOCKS_LINUX_191E0897="1" -DJUCE_APP_VERSION="1.0.0" -DJUCE_APP_VERSION_HEX="0x10000" -DJucePlugin_Build_VST="0" -DJucePlugin_Build_VST3="0" -DJucePlugin_Build_AU="0" -DJucePlugin_Build_AUv3="0" -DJucePlugin_Build_RTAS="0" -DJucePlugin_Build_AAX="0" -DJucePlugin_Build_Standalone="1" -DJucePlugin_Build_Unity="0" -DJUCE_SHARED_CODE="1" -m64 -O0 -std=c++14 -mstackrealign -g -fPIC -pthread -I. -I../../JuceLibraryCode -I/home/noise/JUCE/modules -I/usr/include/freetype2 -c /home/noise/JUCE/Projects/test1/JuceLibraryCode/include_juce_gui_extra.cpp -o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_gui_extra.o
Skipping file (no compiler program set): resources.rc
ar r bin/Debug/libtest1.a obj/Debug/Projects/test1/JuceLibraryCode/include_juce_audio_basics.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_audio_devices.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_audio_formats.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_audio_plugin_client_utils.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_audio_processors.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_audio_utils.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_core.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_data_structures.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_events.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_graphics.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_gui_basics.o obj/Debug/Projects/test1/JuceLibraryCode/include_juce_gui_extra.o obj/Debug/Projects/test1/Source/PluginEditor.o obj/Debug/Projects/test1/Source/PluginProcessor.o
In file included from /home/noise/JUCE/Projects/test1/JuceLibraryCode/include_juce_gui_extra.cpp:9:
/home/noise/JUCE/modules/juce_gui_extra/juce_gui_extra.cpp:121:11: fatal error: 'gtk/gtk.h' file not found
 #include <gtk/gtk.h>
          ^~~~~~~~~~~
1 error generated.
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))

The comment in the Juce library file juce_gui_extra.cpp said:

// If you're missing this header, you need to install the webkit2gtk-4.0 package
 #include <gtk/gtk.h>

But it exists and installed those pacakges:

noise:~$ sudo find / -name gtk.h
/usr/include/gtk-3.0/gtk/gtk.h
noise:~$ sudo apt install webkit2gtk-4.0
Reading package lists... Done
Building dependency tree      
Reading state information... Done


noise:~$ sudo apt install webkit2gtk-driver
Reading package lists... Done
Building dependency tree      
Reading state information... Done
webkit2gtk-driver is already the newest version (2.30.5-0ubuntu0.20.04.1).
The following packages were automatically installed and are no longer required:
  chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi
  libgstreamer-plugins-bad1.0-0 libva-wayland2
Use 'sudo apt autoremove' to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.




noise:~$ sudo apt install libwebkit2gtk-4.0-*
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Note, selecting 'libwebkit2gtk-4.0-37' for glob 'libwebkit2gtk-4.0-*'
Note, selecting 'libwebkit2gtk-4.0-37-gtk2' for glob 'libwebkit2gtk-4.0-*'
Note, selecting 'libwebkit2gtk-4.0-dev' for glob 'libwebkit2gtk-4.0-*'
Note, selecting 'libwebkit2gtk-4.0-doc' for glob 'libwebkit2gtk-4.0-*'
libwebkit2gtk-4.0-37 is already the newest version (2.30.5-0ubuntu0.20.04.1).
libwebkit2gtk-4.0-37 set to manually installed.
libwebkit2gtk-4.0-dev is already the newest version (2.30.5-0ubuntu0.20.04.1).
The following packages were automatically installed and are no longer required:
  chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi
  libgstreamer-plugins-bad1.0-0 libva-wayland2
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  browser-plugin-freshplayer-pepperflash devhelp
The following NEW packages will be installed
  libwebkit2gtk-4.0-37-gtk2 libwebkit2gtk-4.0-doc
0 to upgrade, 2 to newly install, 0 to remove and 0 not to upgrade.
Need to get 419 kB of archives.
After this operation, 9,599 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://gb.archive.ubuntu.com/ubuntu focal-updates/universe amd64 libwebkit2gtk-4.0-37-gtk2 all 2.30.5-0ubuntu0.20.04.1 [29.7 kB]
Get:2 http://gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 libwebkit2gtk-4.0-doc all 2.30.5-0ubuntu0.20.04.1 [389 kB]
Fetched 419 kB in 1s (439 kB/s)                
Selecting previously unselected package libwebkit2gtk-4.0-37-gtk2.
(Reading database ... 195927 files and directories currently installed.)
Preparing to unpack .../libwebkit2gtk-4.0-37-gtk2_2.30.5-0ubuntu0.20.04.1_all.de
b ...
Unpacking libwebkit2gtk-4.0-37-gtk2 (2.30.5-0ubuntu0.20.04.1) ...
Selecting previously unselected package libwebkit2gtk-4.0-doc.
Preparing to unpack .../libwebkit2gtk-4.0-doc_2.30.5-0ubuntu0.20.04.1_all.deb ..
.
Unpacking libwebkit2gtk-4.0-doc (2.30.5-0ubuntu0.20.04.1) ...
Setting up libwebkit2gtk-4.0-37-gtk2 (2.30.5-0ubuntu0.20.04.1) ...
Setting up libwebkit2gtk-4.0-doc (2.30.5-0ubuntu0.20.04.1) ...

TL;DR Version: if anyone else comes across this, also install the dependency: ladspa-sdk

1 Like