Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61158

Build QtWebEngine/Chromium: fontconfig/fontconfig.h not found

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 5.9.0
    • WebEngine
    • None
    • centos7 based docker image, Conda 4.3

    Description

      When building Qt/QtWebEngine, the compilation of Chromium fails because fontconfig/fontconfig.h cannot be found:

      FAILED: obj/content/browser/browser/font_utils_linux.o
      /usr/bin/g++ -MMD -MF obj/content/browser/browser/font_utils_linux.o.d -DENABLE_SCREEN_CAPTURE=1 -DV8_DEPRECATION_WARNINGS -DENABLE_PLUGINS=1 -DENABLE_PDF=1 -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OPENSSL_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DENABLE_WEBRTC=1 -DDISABLE_NACL -DENABLE_TASK_MANAGER=1 -DENABLE_THEMES=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DTOOLKIT_QT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DCONTENT_IMPLEMENTATION -DGL_GLEXT_PROTOTYPES -DUSE_GLX -DUSE_EGL -DLEVELDB_PLATFORM_CHROMIUM=1 -DSK_IGNORE_DW_GRAY_FIX -DSK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS -DSK_SUPPORT_GPU=1 -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DFEATURE_ENABLE_SSL -DFEATURE_ENABLE_VOICEMAIL -DEXPAT_RELATIVE_PATH -DGTEST_RELATIVE_PATH -DNO_MAIN_THREAD_WRAPPING -DNO_SOUND_SYSTEM -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DSSL_USE_OPENSSL -DHAVE_OPENSSL_SSL_H -DFEATURE_ENABLE_SSL -DNO_MAIN_THREAD_WRAPPING -Igen -I../../3rdparty/chromium -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -Igen -I../../3rdparty/chromium/third_party/khronos -I../../3rdparty/chromium/gpu -I../../3rdparty/chromium/third_party/leveldatabase -I../../3rdparty/chromium/third_party/leveldatabase/src -I../../3rdparty/chromium/third_party/leveldatabase/src/include -I../../3rdparty/chromium/skia/config -I../../3rdparty/chromium/skia/ext -I../../3rdparty/chromium/third_party/skia/include/c -I../../3rdparty/chromium/third_party/skia/include/config -I../../3rdparty/chromium/third_party/skia/include/core -I../../3rdparty/chromium/third_party/skia/include/effects -I../../3rdparty/chromium/third_party/skia/include/images -I../../3rdparty/chromium/third_party/skia/include/lazy -I../../3rdparty/chromium/third_party/skia/include/pathops -I../../3rdparty/chromium/third_party/skia/include/pdf -I../../3rdparty/chromium/third_party/skia/include/pipe -I../../3rdparty/chromium/third_party/skia/include/ports -I../../3rdparty/chromium/third_party/skia/include/utils -I../../3rdparty/chromium/third_party/skia/include/gpu -I../../3rdparty/chromium/third_party/skia/src/gpu -I../../3rdparty/chromium/third_party/skia/src/sksl -I../../3rdparty/chromium/third_party/protobuf/src -Igen/protoc_out -I../../3rdparty/chromium/third_party/protobuf/src -Igen/blink -I../../3rdparty/chromium/third_party/icu/source/common -I../../3rdparty/chromium/third_party/icu/source/i18n -I../../3rdparty/chromium/third_party/libwebm/source -I../../3rdparty/chromium/third_party/boringssl/src/include -Igen -I../../3rdparty/chromium/third_party/ced/src -I../../3rdparty/chromium/third_party/WebKit -Igen/third_party/WebKit -I../../3rdparty/chromium/v8/include -Igen/v8/include -I../../3rdparty/chromium/v8/include -Igen/v8/include -I../../3rdparty/chromium/third_party/mesa/src/include -I../../3rdparty/chromium/third_party/angle/src/common/third_party/numerics -Igen/angle -I../../3rdparty/chromium/third_party/libyuv/include -I../../3rdparty/chromium/third_party/re2/src -I../../3rdparty/chromium/third_party/zlib -Igen/ui/resources -Igen/ui/resources -I../../3rdparty/chromium/third_party/webrtc_overrides -I../../3rdparty/chromium/testing/gtest/include -I../../3rdparty/chromium/third_party -I../../3rdparty/chromium/third_party/webrtc_overrides -I../../3rdparty/chromium/third_party -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pipe -pthread -m64 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -fvisibility=hidden -fno-threadsafe-statics -fvisibility-inlines-hidden -std=gnu++11 -Wno-narrowing -fno-rtti -fno-exceptions -c ../../3rdparty/chromium/content/browser/renderer_host/font_utils_linux.cc -o obj/content/browser/browser/font_utils_linux.o
      ../../3rdparty/chromium/content/browser/renderer_host/font_utils_linux.cc:6:35: fatal error: fontconfig/fontconfig.h: No such file or directory
       #include <fontconfig/fontconfig.h>
                                         ^
      compilation terminated.
      

      I think the version provided in qtwebengine/src/3rdparty/chromium/third_party/ should be used, but it is not picked up by Ninja.

      This issue did not occur in Qt 5.8 and the build environment for 5.9 is the same as for 5.8.

      I don't have the fontconfig headers installed globally but in a Conda build environment. This environment's include folder is properly passed to configure and used by Qt itself, but not by Chromium.

      The following patch is a workaround that works on Linux, but is not tested on Mac OS or Windows:

      diff -Naur qtwebengine/src/3rdparty/chromium/content/browser/BUILD.gn qtwebengine/src/3rdparty/chromium/content/browser/BUILD.gn
      --- qtwebengine/src/3rdparty/chromium/content/browser/BUILD.gn
      +++ qtwebengine/src/3rdparty/chromium/content/browser/BUILD.gn
      @@ -121,6 +121,7 @@
           "//third_party/WebKit/public:offscreen_canvas_mojo_bindings",
           "//third_party/WebKit/public:resources",
           "//third_party/angle:angle_common",
      +    "//third_party/fontconfig",
           "//third_party/icu",
           "//third_party/kasko:kasko_features",
           "//third_party/libyuv",
      diff -Naur qtwebengine/src/3rdparty/chromium/ui/gfx/BUILD.gn qtwebengine/src/3rdparty/chromium/ui/gfx/BUILD.gn
      --- qtwebengine/src/3rdparty/chromium/ui/gfx/BUILD.gn
      +++ qtwebengine/src/3rdparty/chromium/ui/gfx/BUILD.gn
      @@ -121,6 +121,7 @@
           "//base:i18n",
           "//base/third_party/dynamic_annotations",
           "//skia",
      +    "//third_party/fontconfig",
           "//third_party/harfbuzz-ng",
           "//third_party/libpng",
           "//third_party/qcms",
      

      Relevant part of the build script:

      # Main variables
      # --------------
      BIN=$PREFIX/lib/qt5/bin
      QTCONF=$BIN/qt.conf
      VER=$PKG_VERSION
      CXXFLAGS=-fno-delete-null-pointer-checks
      # Qt/Chromium needs "python" to be Python 2:
      PATH=$(dirname $(which python2)):$PATH
      
      
      
      # Compile
      # -------
      chmod +x configure
      
      # This might only work on Linux.  Check
      # https://github.com/conda/conda-recipes/tree/master/qt5 for OS X support
      
      MAKE_JOBS=$CPU_COUNT
      
      ./configure -prefix $PREFIX \
                  -bindir $PREFIX/lib/qt5/bin \
                  -headerdir $PREFIX/include/qt5 \
                  -archdatadir $PREFIX/lib/qt5 \
                  -datadir $PREFIX/share/qt5 \
                  -opensource \
                  -confirm-license \
                  -release \
                  -shared \
                  -I $PREFIX/include \
                  -L $PREFIX/lib \
                  -nomake examples \
                  -nomake tests \
                  -qt-pcre \
                  -qt-xcb \
                  -qt-xkbcommon \
                  -qt-libjpeg \
                  -dbus
      
      LD_LIBRARY_PATH=$PREFIX/lib make --quiet -j $MAKE_JOBS
      make install
      

      $PREFIX is the Conda env prefix, e.g. /opt/conda/conda-bld/qt5/_env. $PREFIX/include contains the fontconfig (and other dependency's) headers but they are not installed in the system's default locations.

      Attachments

        For Gerrit Dashboard: QTBUG-61158
        # Subject Branch Project Status CR V

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            sscherfke sscherfke
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes