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

CMake build system: Help users manage long build folder paths

    XMLWordPrintable

Details

    Description

      Summary

      The core issue faced by users is this: By default, Qt Design Studio generated projects end up with extremely long paths (with many many levels of nesting) in the build folder – far longer/deeper than typical project structures. Thus, it's easy to run into Windows path length limits.

      Unfortunately, it is not easy to identify the root cause of the build error from the error log:

      • The "Compile Output" shows error messages that are very cryptic and look unrelated to path lenghts. For example:
        • D:\Development\QtSupport\00483290\build-TestProject-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug_deps\ds-build\src\imports\tools\eventsimulator\QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.cpp : fatal error C1083: Cannot open compiler generated file: '': Invalid argument
        • D:\001_AdminLOI\002_QT\004_SerialPort\build-SerialPort-Desktop_Qt_6_5_1_MinGW_64_bit-Debug_deps\ds-build\src\imports\tools\eventsimulator\QuickStudioEventSimulatorplugin_autogen\include\QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.moc:174: error: opening dependency file _deps\ds-build\src\imports\tools\eventsimulator\CMakeFiles\QuickStudioEventSimulatorplugin.dir\QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.cpp.obj.d: No such file or directory
      • The clearer explanation is buried deep inside Qt Creator's "General Messages" pane, which is easily missed:
        • The object file directory ABC has 190 characters. The maximum full path to an object file is 250 characters (see CMAKE_OBJECT_PATH_MAX). Object file XYZ cannot be safely placed under this directory. The build may not work correctly.

       

      Some suggestions of ways we can help:

      • Support ways to let the build system to generate shorter file/folder names
      • Make the build system provide more obvious guidance to the user when this issue is encountered
      • Restructure the Qt Design Studio Components repository to make it shallower (QDS-10160)
      • Add the Qt Design Studio Components to the official installer, like any other module

       

      Original Report

      I have created a QT quick qml project (6.4), the Cmake was chosen. After build, I got this error:

      "D:\001_AdminLOI\002_QT\004_SerialPort\build-SerialPort-Desktop_Qt_6_5_1_MinGW_64_bit-Debug_deps\ds-build\src\imports\tools\eventsimulator\QuickStudioEventSimulatorplugin_autogen\include\QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.moc:174: error: opening dependency file _deps\ds-build\src\imports\tools\eventsimulator\CMakeFiles\QuickStudioEventSimulatorplugin.dir\QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.cpp.obj.d: No such file or directory
      In file included from C:/Qt/6.5.1/mingw_64/include/QtCore/qglobal.h:34,
                       from C:/Qt/6.5.1/mingw_64/include/QtCore/qnamespace.h:12,
                       from C:/Qt/6.5.1/mingw_64/include/QtCore/qobjectdefs.h:12,
                       from C:/Qt/6.5.1/mingw_64/include/QtCore/qobject.h:10,
                       from C:/Qt/6.5.1/mingw_64/include/QtCore/qplugin.h:12,
                       from C:/Qt/6.5.1/mingw_64/include/QtQml/qqmlextensionplugin.h:7,
                       from D:/001_AdminLOI/002_QT/004_SerialPort/build-SerialPort-Desktop_Qt_6_5_1_MinGW_64_bit-Debug/_deps/ds-build/src/imports/tools/eventsimulator/QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.cpp:3:
      D:/001_AdminLOI/002_QT/004_SerialPort/build-SerialPort-Desktop_Qt_6_5_1_MinGW_64_bit-Debug/_deps/ds-build/src/imports/tools/eventsimulator/QuickStudioEventSimulatorplugin_autogen/include/QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.moc:174:1: fatal error: opening dependency file _deps\ds-build\src\imports\tools\eventsimulator\CMakeFiles\QuickStudioEventSimulatorplugin.dir\QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.cpp.obj.d: No such file or directory
        174 | QT_WARNING_POP
            | ^~~~~~~~~~~~~~"

      The problem is that the full path is very long, in this case, the QT generated a project with many chiuld folders that cause the path is very long, as seen in the above log: _deps\ds-build\src\imports\tools\eventsimulator\CMakeFiles\QuickStudioEventSimulatorplugin.dir\QuickStudioEventSimulatorplugin_QtQuick_Studio_EventSimulatorPlugin.cpp.obj.d

      This path takes 172 chars, while Cmake allow maximum 260 chars.

      Can QT team restructure/refactor the generated folders?  Currently, users only have 260-172 = 88 chars left to be used.

      I have enabled Window Long path already, so I think the 260 chars limitation comes from Cmake.

      Attachments

        Issue Links

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

          Activity

            People

              qtbuildsystem Qt Build System Team
              hoangloi Loi Hoang
              Votes:
              9 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes