astriiddev / Ami-Sampler-VST

VSTi 8-bit Sampler inspired by the sound of the famous Commodore Amiga for Windows/MacOS/Linux using VST3/AU/LV2
GNU General Public License v3.0
173 stars 2 forks source link

Compile error, can't find ft2build.h #3

Closed ngeiswei closed 8 months ago

ngeiswei commented 8 months ago

What is the problem?

Compilation fails under Linux (Debian 12), ft2build.h cannot be found.

How to reproduce the problem?

  1. Open ami.jucer with Projucer and save to generate Builds/LinuxMakefile/Makefile.
  2. Go under Builds/LinuxMakefile/Makefile.
  3. Run make CONFIG=Release

What do you get?

I get the following compilation error

fatal error: ft2build.h: No such file or directory

What else do have to say?

It fails in spite of having

/usr/include/freetype2/ft2build.h

installed on my system.

astriiddev commented 8 months ago

I can't get this to reproduce on Ubuntu 20.04, tbh. A quick google search suggests this may be a common issue with JUCE/Projucer on Debian.

Steps to (Possibly) Resolve Issue

  1. Ensure you have pkg-config installed and it's linking to freetype2 correctly by typing pkg-config --cflags freetype2 into your terminal
  2. Ensure that the line $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) is in the JUCE_CPPFLAGS section in the Makefile generated by Projucer. For me this looks like image on both lines 42 and 93
  3. If it's still not working, try adding the output of pkg-config --cflags freetype2 into the end of both the JUCE_CPPFLAGS sections. For me this would look like image with -I/usr/include/freetype2 -I/usr/include/libpng16 being added to the end

Let me know if this resolves the issue. If so, I'll add it to the BUILD.md instructions under Linux. If not, I'll make a Debian virtual machine and see if I can reproduce the issue within the VM

ngeiswei commented 8 months ago
  1. pkg-config --cflags freetype2 outputs -I/usr/include/freetype2 -I/usr/include/libpng16.
  2. $(shell $(PKG_CONFIG) --cflags alsa freetype2 libcurl webkit2gtk-4.0 gtk+-x11-3.0) is present in the JUCE_CPPFLAGS section in the Makefile.
  3. Adding the -I/usr/include/freetype2 -I/usr/include/libpng16 at the end of the JUCE_CPPFLAGS section still leads to the error.
astriiddev commented 8 months ago

Unfortunately I still can't get this error to reproduce even with a fresh Debian 12 installation in VMplayer

Steps taken to reproduce issue

  1. Fresh Debian 12 install (virtual machine)
  2. Installed build-essential, git, pkg-config, and cmake
  3. Installed libx11-dev, libgtkmm-4.0-dev, libwebkit2gtk-4.0-dev, libasound2-dev, and libcurl4-gnutils-dev (freetype2 was already installed)
  4. Cloned JUCE's git repository and built library, Demorunner, and Projucer
  5. Cloned Ami Sampler git repository
  6. Extracted juce_patch.7z and ran juce_patch.sh
  7. Opened ami.jucer with Projucer and saved jucer file to generate LinuxMakefile
  8. Ran make CONFIG=Release

Other Issues Found

I did find an error in the juce_patch scripts. astro_fmt/codecs/astro_iffAudioFormat.cpp and astro_fmt/codecs/astro_iffAudioFormat.h should be astro_fmt/codecs/astro_IffAudioFormat.cpp and astro_fmt/codecs/astro_IffAudioFormat.h respectively. For some reason, neither Ubuntu 20.04, Windows 11, nor MacOS Sonoma caught this lower-case error and still copied the files over.

However, this was stopping both the IFF format reader and mu-law format reader from copying over in Debian 12. I've since fixed the bat, ps1, and sh files and confirmed that they're working properly in Debian 12. The juce_patch.7z file should be updated in the Ami Sampler repository You can either manually move the IFF and mu-law files over yourself, change those two lines in whichever script you prefer, or download the updated .7z file and replace the scripts.

With any luck, this will fix the issue that you're having; but frankly, I'd be surprised if this was the root of the ft2build.h error. In any case, it's an error that needs to be addressed. If you are still having the ft2build.h error, can you double-check for me that the version of JUCE you're using is the most current version?

ngeiswei commented 8 months ago

Thanks @astriiddev. I had indeed encountered the iff -> Iff typo, which I had fixed to complete patching JUCE.

I'll try to reproduce your steps in a fresh Debian 12 this week-end and try to understand how it differs from my current installation Debian 12.

ngeiswei commented 8 months ago

The version of JUCE I used was 7.0.9, not the latest git revision. I suppose that could potentially be the problem.

ngeiswei commented 8 months ago

I tried on another Debian 12 machine, and it worked! I still do not understand what went wrong with my previous machine.

astriiddev commented 8 months ago

That's great!!! I'm glad to hear it's working for you.

If it's alright with you, I'm going to mark this issue as closed. If you do figure out how to resolve the ft2build.h error on your machine, feel free to let me know how and I'll add it to the BUILD.md as an additional note/disclaimer