JUCE 8 Linux issue with Harfbuzz

When I try to Cmake a JUCE 8 project on Ubuntu 20, I get the following errors during the juceaid build. (I’ve only copied the first few; there are some 60 in all, but they’re all of the same general type):

  extras/Build/juceaide/CMakeFiles/juceaide.dir/__/__/__/modules/juce_graphics/juce_graphics_Harfbuzz.cpp.o


  FAILED:
  extras/Build/juceaide/CMakeFiles/juceaide.dir/__/__/__/modules/juce_graphics/juce_graphics_Harfbuzz.cpp.o


  /usr/bin/c++ -DDEBUG=1 -DJUCE_DISABLE_JUCE_VERSION_PRINTING=1
  -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1
  -DJUCE_MODULE_AVAILABLE_juce_build_tools=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_SILENCE_XCODE_15_LINKER_WARNING=1 -DJUCE_STANDALONE_APPLICATION=1
  -DJUCE_USE_CURL=0 -DLINUX=1 -D_DEBUG=1
  -I/home/chris/Documents/Github/Enso/cmake-build-debug/JUCE/tools/extras/Build/juceaide/juceaide_artefacts/JuceLibraryCode
  -I/home/chris/Documents/Github/JUCE/extras/Build
  -I/home/chris/Documents/Github/JUCE/modules -I/usr/include/uuid
  -I/usr/include/freetype2 -I/usr/include/libpng16 -std=c++17
  -fdiagnostics-color=always -g -O0 -Wall -Wextra -Wpedantic
  -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wsign-compare
  -Wsign-conversion -Wunreachable-code -Wcast-align -Wno-implicit-fallthrough
  -Wno-maybe-uninitialized -Wno-ignored-qualifiers -Wswitch-enum
  -Wredundant-decls -Wno-strict-overflow -Wshadow -Wfloat-equal
  -Wmissing-field-initializers -Woverloaded-virtual -Wreorder
  -Wzero-as-null-pointer-constant -MD -MT
  extras/Build/juceaide/CMakeFiles/juceaide.dir/__/__/__/modules/juce_graphics/juce_graphics_Harfbuzz.cpp.o
  -MF
  extras/Build/juceaide/CMakeFiles/juceaide.dir/__/__/__/modules/juce_graphics/juce_graphics_Harfbuzz.cpp.o.d
  -o
  extras/Build/juceaide/CMakeFiles/juceaide.dir/__/__/__/modules/juce_graphics/juce_graphics_Harfbuzz.cpp.o
  -c
  /home/chris/Documents/Github/JUCE/modules/juce_graphics/juce_graphics_Harfbuzz.cpp


  In file included from /usr/include/c++/9/tuple:38,

                   from /usr/include/c++/9/functional:54,
                   from /home/chris/Documents/Github/JUCE/modules/juce_graphics/fonts/harfbuzz/hb-cplusplus.hh:35,
                   from /home/chris/Documents/Github/JUCE/modules/juce_graphics/fonts/harfbuzz/hb.hh:530,
                   from /home/chris/Documents/Github/JUCE/modules/juce_graphics/juce_graphics_Harfbuzz.cpp:85:

  /usr/include/c++/9/utility:308:22: error: '__make_integer_seq' does not
  name a type

    308 |       using __type = __make_integer_seq<_IdxTuple, size_t, _Num>;
        |                      ^~~~~~~~~~~~~~~~~~

  /usr/include/c++/9/utility:330:9: error: '__make_integer_seq' does not
  name a type

    330 |       = __make_integer_seq<integer_sequence, _Tp, _Num>;
        |         ^~~~~~~~~~~~~~~~~~

  /usr/include/c++/9/utility:343:33: error: 'make_integer_sequence' does
  not name a type; did you mean 'integer_sequence'?

    343 |     using make_index_sequence = make_integer_sequence<size_t, _Num>;
        |                                 ^~~~~~~~~~~~~~~~~~~~~
        |                                 integer_sequence

Any thoughts? This happens on both my WSL build system (Ubuntu 20) and an actual physical Ubuntu 20 machine. The WSL install is my automated build system and has worked flawlessly for years. This is 6/11 where it is failing. The first 5 are other modules (core, etc.)

I think this is implemented as a clang compiler built-in. I’m not sure whether it’s understood by gcc. Have you configured a custom standard library or compiler? My first thought is that your compiler and stdlib are incompatible.

Are you able to successfully build a non-JUCE C++ file that includes <functional>, <tuple>, and <utility>, with the same compiler + stdlib that you are using for your JUCE builds?

You are confusing me with someone that doesn’t ship product. You can faff about with customizing Linux, or you can ship, but you can’t do both. :wink:

In all seriousness, after experimentation, the issue is that stock vanilla Ubuntu 20 (which is our build platform for maximum compatibility) comes with GCC 9. JUCE 8’s Harfbuzz features require GCC 10 or higher. So it was a matter of changing from GCC 9 / G++ 9 to GCC 11 / G++ 11, then all is well.

For those of you that find this via searching for similar issues, here are the magic phrases:

This will install gcc/g++ 11:

sudo apt install g++-11 gcc-11

And this will make it the default:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11

Ubuntu 22 and up should build JUCE 8 products fine, but trust me when I say you’ll have different problems, if you’re new to shipping Linux. Ubuntu 20 and GCC 11 is the sweet spot. Note that if you want to run GCC higher than 11 on Ubuntu 20 and its derivatives, you’ll need to build from source. apt and snap do not have GCC 12+ on 20.

3 Likes