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

GN: issues building gn_unittests target



    • Bug
    • Status: Closed
    • Not Evaluated
    • Resolution: Won't Do
    • 5.15.8
    • None
    • WebEngine
    • None


      In an attempt to modularize building of QtWebEngine 5.15.x, I looked into whether the GN bundled in qtwebengine-chromium could be built separately (I understand that doing so is likely unsupported). I notice various things appear to be currently broken in the gn_unittests target; I am reporting these in case others are interested and/or had expected it to work. What is described in this report does not impact ordinary builds of QtWebEngine 5.15.x, which only build the gn target.

      1. The file gn/src/gn/function_filter_unittest.cc (from backport commit 84164e4) is not in the path specified in executables['gn_unittests']['sources'] of gn/build/gen.py. Presumably the file should be moved to gn/tools/gn/, where the rest of the unit test files reside.
      2. gn/tools/gn/ninja_target_command_util_unittest.cc (from backport commit 677e14d0) uses ESCAPE_SPACE, and so does not compile without backporting GN upstream commit 5624679 (as well as adjusting the signature of EscapeStringToString_Space() so that it accepts a const base::StringPiece& instead of a const std::string_view&).
      3. Multiple files seem to need include header path adjustment (possibly by prepending "tools/"). The affected source files and include headers are:

        gn/tools/gn/frameworks_utils_unittest.cc: gn/frameworks.h
        gn/tools/gn/function_filter_unittest.cc: gn/functions.h, gn/test_with_scope.h
        gn/tools/gn/ninja_target_command_util_unittest.cc: gn/ninja_target_command_util.h

      4. gn/tools/gn/qmake_link_writer_unittest.cc does not compile because a pointer to NinjaBinaryTargetWriter writer is being passed to the QMakeLinkWriter constructor, which expects const NinjaCBinaryTargetWriter * i.e. a pointer to a child class of NinjaBinaryTargetWriter (see gn/tools/gn/qmake_link_writer.h). Possible fixes could be to have the unit test file instead declare writer as NinjaCBinaryTargetWriter (and include ninja_c_binary_target_writer.h instead of ninja_binary_target_writer.h), or have the QMakeLinkWriter constructor instead expect const NinjaBinaryTargetWriter * (as currently done on qtwebengine-chromium branch 69-based), but I do not know which approach is correct/preferred.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            qt_webengine_team Qt WebEngine Team
            chrstphrchvz Christopher Chavez
            0 Vote for this issue
            2 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes