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

Multiple extra compilers with same input are broken for VS projects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.2
    • Build tools: qmake
    • None
    • Windows

    Description

      The dbus examples of qtbase do not build with msbuild and cannot even be loaded in Visual Studio.

      The msbuild error is:

      "D:\dev\qt\dev-x86_64\qtbase\examples\dbus\chat\chat.vcxproj" (Build target) (1) ->
      (CustomBuild target) ->
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.tar
      gets(200,5): error MSB4018: The "GetOutOfDateItems" task failed unexpectedly. [D:\dev\qt\dev-x86_64\qtbase\examples\
      dbus\chat\chat.vcxproj]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targe
      ts(200,5): error MSB4018: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dict
      ionary. [D:\dev\qt\dev-x86_64\qtbase\examples\dbus\chat\chat.vcxproj]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targe
      ts(200,5): error MSB4018:    at System.Collections.Generic.Dictionary`2.get_Item(TKey key) [D:\dev\qt\dev-x86_64\qtb
      ase\examples\dbus\chat\chat.vcxproj]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targe
      ts(200,5): error MSB4018:    at Microsoft.Build.CPPTasks.GetOutOfDateItems.CheckIfItemDependsOnOtherItemOutputs(ITas
      kItem item, Dictionary`2 itemDependencies, Dictionary`2 allOutputs, HashSet`1 outOfDateItemHash) [D:\dev\qt\dev-x86_
      64\qtbase\examples\dbus\chat\chat.vcxproj]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targe
      ts(200,5): error MSB4018:    at Microsoft.Build.CPPTasks.GetOutOfDateItems.Execute() [D:\dev\qt\dev-x86_64\qtbase\ex
      amples\dbus\chat\chat.vcxproj]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targe
      ts(200,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost
      .Execute() [D:\dev\qt\dev-x86_64\qtbase\examples\dbus\chat\chat.vcxproj]
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targe
      ts(200,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [D:\de
      v\qt\dev-x86_64\qtbase\examples\dbus\chat\chat.vcxproj]
      

      chat.pro has the following bit

      QT += dbus
      ...
      DBUS_ADAPTORS += org.example.chat.xml
      DBUS_INTERFACES += org.example.chat.xml
      

      This means multiple extra compilers are operating on the same input, and that is broken in the VS project generator, because the input file is added multiple files to different filters, which is not supported in VS project files.

      This would be fixable. But read on...

      Even if the project file would reference the file only once, then we'd get the same error, because of the code in mkspecs/features/dbuscommon.pri:

          $${group}_header.commands = $$QMAKE_QDBUSXML2CPP $$hdr_flags $$qdbusxml2cpp_option ${QMAKE_FILE_OUT}: ${QMAKE_FILE_IN}
          $${group}_header.depends += $$QMAKE_QDBUSXML2CPP_EXE
          $${group}_header.output = ${QMAKE_FUNC_FILE_IN_qdbusOutputBasename}_$${dbus_type}.h
          $${group}_header.name = DBUSXML2CPP $${dbus_TYPE} HEADER ${QMAKE_FILE_IN}
          $${group}_header.variable_out = $${GROUP}_HEADERS
          $${group}_header.input = $$input_list
      
          $${group}_source.commands = $$QMAKE_QDBUSXML2CPP -i ${QMAKE_FILE_OUT_BASE}.h $$src_flags $$qdbusxml2cpp_option :${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
          $${group}_source.depends += $$QMAKE_QDBUSXML2CPP_EXE
          $${group}_source.output = ${QMAKE_FUNC_FILE_IN_qdbusOutputBasename}_$${dbus_type}.cpp
          $${group}_source.name = DBUSXML2CPP $${dbus_TYPE} SOURCE ${QMAKE_FILE_IN}
          $${group}_source.variable_out = SOURCES
          $${group}_source.input = $$input_list
          $${group}_source.depends += $$eval($${group}_header.output)   # this actually belongs to the object file
      

      which are two extra compilers operating on the same input.

      All in all, we have four extra compilers operating on org.example.chat.xml.

      The problem here is:
      one extra compiler creates a header file and one a .cpp file from the same input.
      For the header file, we create a custom build tool on the generated header file.
      For the source file, we create a custom build tool on the input file (because the output file cannot have one - it must have the C++ compiler tool).
      This seems to confuse the heck out of msbuild.

      Attachments

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

        Activity

          People

            qtbuildsystem Qt Build System Team
            jbornema Joerg Bornemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: