Trouble building static library (Arch Linux)

So I’m trying to make a little app to make music modding in a game easier. As part of that, I want some basic music processing tools built-in to make things easier for users. (Converting to OGG, at least. Stuff like checking music length is also needed because it can cause problems if a few songs aren’t the right length.)

After finding that, among other things, documentation for FFMPEG is woefully lacking (and quickly depreciated - passing things to command line may also get outdated over time), I looked for something static and better-documented I could include, instead. JUCE was highly recommended as being easy to use.

…there should be an asterisk… :joy: I’ve been having trouble with just about every step, and having trouble finding up-to-date, complete information that doesn’t rely on knowledge I don’t have. (Or that wasn’t specific to another type of usecase.)

I actually started by using my package manager to install JUCE, only to find that it’s an outdated version (7.0.12). I’ve now got the latest Projucer (8.0.3) downloaded and put in my home folder. I should have all the dependencies (package manager should’ve got them + they all sound familiar).

TBH, I’m not 100% sure this is the best place, since I’m having trouble with several steps, many not directly related to JUCE, and a lot of them are kind of embarassing. :sweat_smile: But I need whatever I can find from wherever I can.

First off… I’m actually not sure how to build a project produced by JUCE. (Or really how such things work, in general. :sweat_smile: ) I’ve used CMake and stuff, but only with step-by-step instructions specific to the thing I’ve compiled. E.g. I found the instructions to build the DemoRunner, but adapting them for one of my projects didn’t work. Most tutorials I’ve found are about how to MAKE a Makefile. I finally managed to learn to try just using make in the folder with the auto-generated Makefile… but got this output:

Compiling include_juce_analytics.cpp
Compiling include_juce_animation.cpp
Compiling include_juce_audio_basics.cpp
Compiling include_juce_audio_devices.cpp
Compiling include_juce_audio_formats.cpp
Compiling include_juce_audio_plugin_client_ARA.cpp
In file included from ../../../../modules/juce_audio_plugin_client/juce_audio_plugin_client_ARA.cpp:36,
from ../../JuceLibraryCode/include_juce_audio_plugin_client_ARA.cpp:8:
../../../../modules/juce_audio_plugin_client/detail/juce_CheckSettingMacros.h:42:3: error: #error "You need to enable at least one plugin format!"
42 |  #error "You need to enable at least one plugin format!"
|   ^~~~~
../../../../modules/juce_audio_plugin_client/detail/juce_CheckSettingMacros.h:51:3: error: #error "You need to define the JucePlugin_IsSynth value!"
51 |  #error "You need to define the JucePlugin_IsSynth value!"
|   ^~~~~
../../../../modules/juce_audio_plugin_client/detail/juce_CheckSettingMacros.h:55:3: error: #error "You need to define the JucePlugin_ManufacturerCode value!"
55 |  #error "You need to define the JucePlugin_ManufacturerCode value!"
|   ^~~~~
../../../../modules/juce_audio_plugin_client/detail/juce_CheckSettingMacros.h:59:3: error: #error "You need to define the JucePlugin_PluginCode value!"
59 |  #error "You need to define the JucePlugin_PluginCode value!"
|   ^~~~~
../../../../modules/juce_audio_plugin_client/detail/juce_CheckSettingMacros.h:63:3: error: #error "You need to define the JucePlugin_ProducesMidiOutput value!"
63 |  #error "You need to define the JucePlugin_ProducesMidiOutput value!"
|   ^~~~~
../../../../modules/juce_audio_plugin_client/detail/juce_CheckSettingMacros.h:67:3: error: #error "You need to define the JucePlugin_WantsMidiInput value!"
67 |  #error "You need to define the JucePlugin_WantsMidiInput value!"
|   ^~~~~
../../../../modules/juce_audio_plugin_client/detail/juce_CheckSettingMacros.h:75:3: error: #error "You need to define the JucePlugin_EditorRequiresKeyboardFocus value!"
75 |  #error "You need to define the JucePlugin_EditorRequiresKeyboardFocus value!"
|   ^~~~~
make: *** [Makefile:145: build/intermediate/Debug/include_juce_audio_plugin_client_ARA_31a052ed.o] Error 1

I’m hoping once I have that figured out, I’ll have one of the biggest hurdles over with. :sweat_smile: What am I doing wrong? …Or is any of this on JUCE’s side? (I’m not trying to make a plugin, so I don’t see why it should complain about plug-in settings being missing. :thinking: )

Also, I’m using Eclipse because it was used in my programming classes, but for some reason including external libraries wasn’t covered, and I’m having trouble finding complete info for THAT too. :expressionless: If anyone could give info on that too, I’d also appreciate it.

Please excuse me if I’m a little helpless. :sweat_smile:

Do NOT use a package manager to install JUCE.

If you’re going to develop a JUCE Application, first clone the JUCE repo (with submodules) and then, the very first thing you do is build your own local copy of the Projucer application using one of the appropriate build harnesses provided in $JUCE/extras/Projucer/Builds … then, run that freshly-built Projucer, set up the path to the cloned JUCE directory and any modules you intend to use, and use your newly-built Projucer to start a new “JUCE Application” project. Be sure to check the entire configuration carefully.

What I usually do, is make a repository for my own application first, then add JUCE as a submodule to that repository, then fire up a successful build of Projucer from that directory, and set all that paths for that project properly, to the custom application repo. Then, be sure you build the included DemoRunner project - all newcomers to JUCE should make DemoRunner their first ‘proof of properly set up JUCE project’ step … and also, please refer to the DemoRunner as you develop your application - it has all the answers.

Don’t bother trying to have a “one JUCE repo for all projects” approach - instead, just treat JUCE as a module for every project you start.

Once you get this far, use Projucer to generate a JUCE Application project from the template, and then build that project first, before making any further changes. You should be able to get all the way to a running JUCE Application (which does nothing) without any hassles whatsoever, and once you have that basic application built, can continue with further development.

Note, you can also use the CMakeLists.txt that is provided in many of the example/extras from JUCE as a basis for your new JUCE Application. If you take this approach, I would highly recommend getting CLion, as it has superlative support for CMake-based projects, and once you get it set up it will help you navigate the JUCE classes.

JUCE can be built as a static library, but it’s quite awkward and generally not a good idea. It’ll probably be easiest to start with a console or GUI app template using Projucer/CMake.

We don’t intend users to write makefiles to build JUCE directly. Instead, you should use either Projucer or CMake to generate build files (such as makefiles) for your project. To get started with the Projucer, you can build it using the provided makefile in extras/Projucer/Builds/LinuxMakefile and then run it. To get started with CMake, take a look at the example projects in examples/CMake, which are heavily commented.

I’d second @ibisum here, and advise using CLion instead. CLion is probably the best-supported IDE for JUCE projects on Linux.

Excuse me if I’m a bit frustrated, because it seems like neither of you fully read my post, and you both came across as patronizing. I’m helpless in figuring out how to BUILD a project beside the DemoBuild - not so much the other parts. I tried to demonstrate that.

Do NOT use a package manager to install JUCE.

I explicitly said that after I discovered the package manager version was outdated, “I’ve now got the latest Projucer (8.0.3) downloaded and put in my home folder.

If you’re going to develop a JUCE Application

That’s not my goal. I want to develop an application that uses a audio-processing methods for convenience, but audio processing is not the main goal of the app.

use Projucer to generate a JUCE Application project from the template, and then build that project first

I decided to humor you guys, even though I basically did just that already. I did the default audio application project, with zero changes to the code or generated files. I did the exact same thing as I originally did with my initial static-library project - that is, open a console with a folder with the auto-generated makefile and run make which is all I know how to do ATM. Here are the results:

╭─scia@scia in ~/JUCE/examples/YouGuysHappyNow/Builds/LinuxMakefile
╰─λ make
Compiling Main.cpp
Compiling MainComponent.cpp
Compiling include_juce_audio_basics.cpp
Compiling include_juce_audio_devices.cpp
Compiling include_juce_audio_formats.cpp
Compiling include_juce_audio_processors.cpp
Compiling include_juce_audio_processors_ara.cpp
Compiling include_juce_audio_processors_lv2_libs.cpp
Compiling include_juce_audio_utils.cpp
Compiling include_juce_core.cpp
Compiling include_juce_data_structures.cpp
Compiling include_juce_events.cpp
Compiling include_juce_graphics.cpp
Compiling include_juce_gui_basics.cpp
Compiling include_juce_gui_extra.cpp
Linking YouGuysHappyNow - App
/usr/bin/ld: build/intermediate/Debug/include_juce_core_f26d17db.o: undefined reference to symbol 'inflateInit2_'
/usr/bin/ld: /usr/lib/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:102: build/YouGuysHappyNow] Error 1

(I tried using screenshots so hopefully things would be more clear, but apparently I can’t include more than one.)

It still throws an error. I still don’t have a successfully-compiled app. The only thing that’s created in the Build folder is a number of sub-folders, eventually ending in what looks like a bunch of semi-compiled source files… but no app.

all newcomers to JUCE should make DemoRunner their first ‘proof of properly set up JUCE project’ step

I did. THAT one worked. But for some reason, trying to adapt the step-by-step build instructions so that I entered my project name in the terminal, instead of DemoRunner, didn’t work.

Commands + output when trying to build the DemoRunner:

╭─scia@scia in ~/JUCE via △ v3.30.5
╰─λ cmake . -B cmake-build -DJUCE_BUILD_EXAMPLES=ON -DJUCE_BUILD_EXTRAS=ON
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
-- Testing juceaide
-- Finished setting up juceaide
-- Configuring done (1.6s)
-- Generating done (1.5s)
-- Build files have been written to: /home/scia/JUCE/cmake-build

╭─scia@scia in ~/JUCE via △ v3.30.5 took 3s
╰─λ cmake --build cmake-build --target DemoRunner
[100%] Built target DemoRunner

Commands + output when trying to follow the same steps to build the library:

╭─scia@scia in ~/JUCE via △ v3.30.5
╰─λ cmake . -B cmake-build -DJUCE_BUILD_EXAMPLES=ON -DJUCE_BUILD_EXTRAS=ON
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
-- Testing juceaide
-- Finished setting up juceaide
-- Configuring done (1.6s)
-- Generating done (1.6s)
-- Build files have been written to: /home/scia/JUCE/cmake-build

╭─scia@scia in ~/JUCE via △ v3.30.5 took 3s
╰─λ cmake --build cmake-build --target JUCElibsFull
make: *** No rule to make target 'JUCElibsFull'.  Stop.

…and when trying to build the default audio app:

╭─scia@scia in ~/JUCE via △ v3.30.5
[🔴] × cmake . -B cmake-build -DJUCE_BUILD_EXAMPLES=ON -DJUCE_BUILD_EXTRAS=ON
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
-- Testing juceaide
-- Finished setting up juceaide
-- Configuring done (1.6s)
-- Generating done (1.6s)
-- Build files have been written to: /home/scia/JUCE/cmake-build

╭─scia@scia in ~/JUCE via △ v3.30.5 took 3s
╰─λ cmake --build cmake-build --target YouGuysHappyNow
make: *** No rule to make target 'YouGuysHappyNow'.  Stop.

Aaaand there’s no app for me to run.

The DemoRunner runs (though crashes sometimes), but I can’t run the default audio project because there is no built app.

Building the DemoRunner did NOT teach me how to build other projects. Hence, why I asked how.

We don’t intend users to write makefiles to build JUCE directly. Instead, you should use either Projucer or CMake to generate build files (such as makefiles) for your project. To get started with the Projucer, you can build it using the provided makefile in extras/Projucer/Builds/LinuxMakefile and then run it.

I never said I wrote my own makefile. I tried to say that I tried to find guides on how to use someone else’s makefile, but only found guides on how to make my own, which were not very helpful, and did not really answer my question. The only think I learned was to try using the command make in the same folder as the auto-generated makefile, but as I have shown twice now, doing so throws errors, and doesn’t provide me with a compiled project.

So since search engines failed me, I turned here.

Aaaand you still haven’t answered my primary question on how to build one of these projects… or if maybe there’s a bug in JUCE.

So, to reiterate (again):

How do I build a project using the auto-generated Makefile? Am I doing something wrong, or is there a bug that needs to be fixed?

And please, don’t answer any questions that weren’t asked this time, especially if you might not understand what it is I’m trying to say. I consider that very unkind and disrespectful to anybody, and you only demonstrated that you didn’t understand, and didn’t try to get clarification. If I find the community patronizing, I’ll try another solution to my problem.

I understand your frustration but you’ve got also to understand that many of us do not have the problems you’ve encountered, so there must be something about the assumptions you’ve made that are not quite correct.

Are you trying to use JUCE as a static library and then include it in your application, built with some other framework/stack? This is going to be frustrating, because JUCE is a heavy-lifting framework and requires quite a bit of effort to integrate as a static library, and while its possible - you’re not going to have a good time if you haven’t, first of all, built your own Projucer and then used it to produce a working ‘out of the box’ JUCE Application, which includes the JUCE modules you might find useful, and which you are able to build and run successfully, without making any further changes.

So, first do things standardly. Configure and build a “standard” JUCE Application using the Projucer, and then run that Application, open its sources in your IDE, navigate to gain an understanding of the application and its use of JUCE modules, and so on.

Then, once that is confirmed as working in your environment, we can help you with the rest of the issues you’ll encounter while integrating JUCE as a static library, also …

FWIW, I have built (for MacOS/Linux/Windows/iOS) many standalone JUCE Applications for my needs (tooling) and have not had any issues just taking the standard path to the configuration, creating, and building. It should be easy. If its not, some assumption made is not quite correct …

Sorry about that. It’s sometimes difficult to convey the desired tone through text.

For a Makefile generated by Projucer, or included in the JUCE distribution, it should be enough to navigate to the directory holding the makefile, and then to run make. CMake-generated makefiles are the same, but will only work when invoked from the top-level directory, i.e. if you run cmake -B cmake-build then you can only run make from inside the cmake-build directory, but not any subdirectories.

The commands you shared for building your projects with CMake are unlikely to work. I’d say that you’re doing that wrong. However, your procedure for building a Projucer-generated project looks correct. From the information provided, it’s difficult to say whether this is due to a bug in JUCE, or whether there’s a configuration issue on your build machine.

This symbol should normally be defined in JUCE itself, but it can be disabled based on configuration options, in which case you’d need to link zlib yourself. It doesn’t sound like you’ve changed any configuration options, so this might indicate a bug in JUCE. Is it possible that your computer has a copy of the zlib source files stored locally in your system include directories? Does it help if you add the prefix juce_core/zip to each of the includes at the top of modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp like so?

#include "zlib/zlib.h"               // before

#include "juce_core/zip/zlib/zlib.h" // after

I’d also be interested to know what happens when you run make from examples/DemoRunner/Builds/LinuxMakefile.