While compiling vst in linux: ft2build.h: No such file or directory

Hi! I decided to give Juce another try, this time in Ubuntu. I could create a standalone plugin, but I run into trouble trying to follow the Juce vst tutorial. I cannot compile the plugin.

Compiling include_juce_graphics.cpp
In file included from ../../JuceLibraryCode/include_juce_graphics.cpp:8:
.../Juce/modules/juce_graphics/juce_graphics.cpp:92:12: fatal error: ft2build.h: No such file or directory
   92 |   #include <ft2build.h>
      |            ^~~~~~~~~~~~
compilation terminated.

libfreetype6-dev is installed, and I can actually find the ft2build.h file in /usr/include/freetype2/.
Sadly I don’t understand much about makefiles, plus any fix I could do in it, would get overwritten after any edit in projucer. How does one fix this issue? Many thanks in advance

Hi,

Is it plugin from examples or your own?

What

pkg-config --cflags freetype2

says?

thank you!

pkg-config --cflags freetype2

says

-I/usr/include/freetype2 -I/usr/include/libpng16

The plugin is not from examples, I was following the official Juce tutorial for vst’s. It is an interesting question. I opened an example and attempted to build it (SamplerPlugin), and it fails with the same error.

Hm…

V=1 make

will give exact compiler’s command line with flags and paths
also you can check Makefile for this line:

(shell pkg-config --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0)

as it works fow me

this appears twice in the makefile, though it is part of a longer line:

 $(shell pkg-config --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0)

V=1 make produces a very long text (I added the line breaks to make it more readable, it was only one line)

g++  -MMD "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1"
"-DPIP_JUCE_EXAMPLES_DIRECTORY=L2hvbWUvam9hcXVpbi9KdWNlL2V4YW1wbGVz" 
"-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" 
"-DJUCE_APP_VERSION_HEX=0x10000" "-DJUCE_DISPLAY_SPLASH_SCREEN=1"
"-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x60001" 
"-DJUCE    _MODULE_AVAILABLE_juce_audio_basics=1" 
"-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" 
"-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" 
"-DJUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1" 
"-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" 
"-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" 
"-DJUCE_MODULE_AVAILABLE_juce_core=1" 
"-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" 
"-DJUCE_MODULE_AVAILABLE_juce_events=1"  
"-DJUCE_MODULE_AVAILABLE_juce_graphics=1" 
"-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" 
"-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" 
"-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" 
"-DJUCE_VST3_CAN_REPLACE_VST2=0" 
"-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJucePlugin_Build_VST=0" 
"-DJucePlugin_Build_VST3=1" "-DJucePlugin_Build_AU=1" "-DJucePlugin_Build_AUv3=0" 
"-DJucePlugin_Build_RTAS=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=1" 
"-DJucePlugin_Build_Unity=0" "-DJucePlugin_Enable_IAA=0" 
"-DJucePlugin_Name=\"SamplerPlugin\"" "-DJucePlugin_Desc=\"SamplerPlugin\"" 
"-DJucePlugin_Manufacturer=\"JUCE\"" "-DJucePlugin_ManufacturerWebsite=\"http://juce.com\"" 
"-DJucePlugin_ManufacturerEmail=\"\"" "-DJucePlugin_ManufacturerCode=0x4d616e75" 
"-DJucePlugin_PluginCode=0x53303738" "-DJucePlugin_IsSynth=0" 
"-DJucePlugin_WantsMidiInput=0" "-DJucePlugin_ProducesMidiOutput=0" 
"-DJucePlugin_IsMidiEffect=0" "-DJucePlugin_EditorRequiresKeyboardFocus=0" 
"-DJucePlugin_Version=1.0.0" "-DJucePlugin_VersionCode=0x10000" 
"-DJucePlugin_VersionString=\"1.0.0\"" "-DJucePlugin_VSTUniqueID=JucePlugin_PluginCode" 
"-DJucePlugin_VSTCategory=kPlugCategEffect" "-DJucePlugin_Vst3Category=\"Fx\"" 
"-DJucePlugin_AUMainType='aufx'" "-DJucePlugin_AUSubType=JucePlugin_PluginCode" 
"-DJucePlugin_AUExportPrefix=SamplerPluginAU" 
"-DJucePlugin_AUExportPrefixQuoted=\"SamplerPluginAU\"" 
"-DJucePlugin_AUManufacturerCode=JucePlugin_ManufacturerCode" 
"-DJucePlugin_CFBundleIdentifier=com.JUCE.SamplerPlugin" "-DJucePlugin_RTASCategory=0" 
"-DJucePlugin_RTASManufacturerCode=JucePlugin_ManufacturerCode" 
"-DJucePlugin_RTASProductId=JucePlugin_PluginCode" "-DJucePlugin_RTASDisableBypass=0" 
"-DJucePlugin_RTASDisableMultiMono=0" "-DJucePlugin_AAXIdentifier=com.JUCE.SamplerPlugin" 
"-DJucePlugin_AAXManufacturerCode=JucePlugin_ManufacturerCode" 
"-DJucePlugin_AAXProductId=JucePlugin_PluginCode" "-DJucePlugin_AAXCategory=0" 
"-DJucePlugin_AAXDisableBypass=0" "-DJucePlugin_AAXDisableMultiMono=0" 
"-DJucePlugin_IAAType=0x61757278" "-DJucePlugin_IAASubType=JucePlugin_PluginCode" 
"-DJucePlugin_IAAName=\"JUCE: SamplerPlugin\"" "-DJucePlugin_VSTNumMidiInputs=16" 
"-DJucePlugin_VSTNumMidiOutputs=16" 
"-DJUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone"  -pthread -I/home/me
/Juce/modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I/home
/me/Juce/modules   -fPIC -g -ggdb -O0  -std=c++14  "-DJUCE_SHARED_CODE=1"  -o 
"build/intermediate/Debug/include_juce_graphics_f817e147.o" -c "../../JuceLibraryCode
/include_juce_graphics.cpp"

You can paste whole line or upload it at some hosting (http://susepaste.org/ for example)
I see the line

-I/home/me
/Juce/modules/juce_audio_processors/format_types/VST3_SDK -I../../JuceLibraryCode -I/home
/me/Juce/modules

is not complete?

I did paste the whole line, I just added line breaks so that it’s easier to read.
What is missing?

Somehow it ignores include path from pkg-config. I’m not yet sure why it happens, what’s your Ubuntu version and shell?

Kubuntu 20.04
Konsole 19.12.3

$(shell pkg-config --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0)

should add include paths to compiler’s args
this how it looks on my ubuntu 20.04:

Compiling include_juce_graphics.cpp
g++  -MMD "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DPIP_JUCE_EXAMPLES_DIRECTORY=L2hvbWUva3Yvc3JjL0pVQ0UvZXhhbXBsZXM=" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" "-DJUCE_DISPLAY_SPLASH_SCREEN=1" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x60001" "-DJUCE_MODULE_AVAILABLE_juce_audio_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_devices=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_formats=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_processors=1" "-DJUCE_MODULE_AVAILABLE_juce_audio_utils=1" "-DJUCE_MODULE_AVAILABLE_juce_core=1" "-DJUCE_MODULE_AVAILABLE_juce_data_structures=1" "-DJUCE_MODULE_AVAILABLE_juce_events=1" "-DJUCE_MODULE_AVAILABLE_juce_graphics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_basics=1" "-DJUCE_MODULE_AVAILABLE_juce_gui_extra=1" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_VST3_CAN_REPLACE_VST2=0" "-DJUCE_STRICT_REFCOUNTEDPOINTER=1" "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=1" "-DJucePlugin_Build_AU=1" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_RTAS=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=1" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Enable_IAA=0" "-DJucePlugin_Name=\"SamplerPlugin\"" "-DJucePlugin_Desc=\"SamplerPlugin\"" "-DJucePlugin_Manufacturer=\"JUCE\"" "-DJucePlugin_ManufacturerWebsite=\"http://juce.com\"" "-DJucePlugin_ManufacturerEmail=\"\"" "-DJucePlugin_ManufacturerCode=0x4d616e75" "-DJucePlugin_PluginCode=0x507a736a" "-DJucePlugin_IsSynth=0" "-DJucePlugin_WantsMidiInput=0" "-DJucePlugin_ProducesMidiOutput=0" "-DJucePlugin_IsMidiEffect=0" "-DJucePlugin_EditorRequiresKeyboardFocus=0" "-DJucePlugin_Version=1.0.0" "-DJucePlugin_VersionCode=0x10000" "-DJucePlugin_VersionString=\"1.0.0\"" "-DJucePlugin_VSTUniqueID=JucePlugin_PluginCode" "-DJucePlugin_VSTCategory=kPlugCategEffect" "-DJucePlugin_Vst3Category=\"Fx\"" "-DJucePlugin_AUMainType='aufx'" "-DJucePlugin_AUSubType=JucePlugin_PluginCode" "-DJucePlugin_AUExportPrefix=SamplerPluginAU" "-DJucePlugin_AUExportPrefixQuoted=\"SamplerPluginAU\"" "-DJucePlugin_AUManufacturerCode=JucePlugin_ManufacturerCode" "-DJucePlugin_CFBundleIdentifier=com.JUCE.SamplerPlugin" "-DJucePlugin_RTASCategory=0" "-DJucePlugin_RTASManufacturerCode=JucePlugin_ManufacturerCode" "-DJucePlugin_RTASProductId=JucePlugin_PluginCode" "-DJucePlugin_RTASDisableBypass=0" "-DJucePlugin_RTASDisableMultiMono=0" "-DJucePlugin_AAXIdentifier=com.JUCE.SamplerPlugin" "-DJucePlugin_AAXManufacturerCode=JucePlugin_ManufacturerCode" "-DJucePlugin_AAXProductId=JucePlugin_PluginCode" "-DJucePlugin_AAXCategory=0" "-DJucePlugin_AAXDisableBypass=0" "-DJucePlugin_AAXDisableMultiMono=0" "-DJucePlugin_IAAType=0x61757278" "-DJucePlugin_IAASubType=JucePlugin_PluginCode" "-DJucePlugin_IAAName=\"JUCE: SamplerPlugin\"" "-DJucePlugin_VSTNumMidiInputs=16" "-DJucePlugin_VSTNumMidiOutputs=16" "-DJUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone" -pthread -I/usr/include/x86_64-linux-gnu -I/usr/include/webkitgtk-4.0 -I/usr/include/gtk-3.0 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/webkitgtk-4.0 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/home/kv/src/JUCE/modules/juce_audio_processors/format_types/VST3_SDK -I/home/kv/VST2_SDK -I../../JuceLibraryCode -I/home/kv/src/JUCE/modules   -fPIC -g -ggdb -O0  -std=c++14  "-DJUCE_SHARED_CODE=1"  -o "build/intermediate/Debug/include_juce_graphics_f817e147.o" -c "../../JuceLibraryCode/include_juce_graphics.cpp"

What paths should I add?
I found somewhere in reddit how to add the path to that ft2build

CPATH=/usr/include/freetype2 make

but adding it just leads me into the same problem but with a different library:

fatal error: gtk/gtk.h: No such file or directory

I do have it installed, too.

I fear that there will be many libraries that juce doesn’t find and I will never end trying to compile my first plugin. I also tried using the develop version of Juce, no luck. Isn’t there a proper way to use juce in linux that I am missing?

You might want to read

I hope this helps.

hey, Happy birthday! :smile:

Ok, following that documentation made it work. I don’t understand why it works, since my previous problem was not the absence of the plugins, but the failure of the makefile to find the dependencies.

Anyways, that makes me happy because now I can start learning. Many thanks!

–edit–
For the sake of completeness, these are the packages that were not installed:

The following additional packages will be installed:
libbrotli-dev libjavascriptcoregtk-4.0-dev libpsl-dev libsoup2.4-dev libxml2-dev
Suggested packages:
libsoup2.4-doc
The following NEW packages will be installed:
libbrotli-dev libjavascriptcoregtk-4.0-dev libpsl-dev libsoup2.4-dev libwebkit2gtk-4.0-dev libxml2-dev
mesa-common-dev