Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Can't build Qt 6.0.0 due to MAX_PATH with shallow directory depth



  • Hi,

    Moving to give Qt6 a whirl and I'm getting stuck at the configure step. Something is odd is happening with how the CMake scripts are manipulating some paths as I'm getting complaints that a few of the generated build directories are too deep for a few of the would-be object files, despite nearly building at a drive root.

    Setup:

    • Windows 10, MSVC2019, recent Python 3.X, Ruby, and ActivePerl installed and in PATH
    • Qt6 Sources at C:\qt-everywhere-src-6.0.0
    • Shadow build directory at C:\Q
    • Install output at C:\B

    Configuration Input:

    // Using MSVC2019 x64 Native Tools CMD
    cd C:\Q
    C:\qt-everywhere-src-6.0.0\configure.bat -static -debug-and-release -prefix C:\B -platform win32-msvc -opensource -confirm-license -skip webengine -nomake tools -nomake examples -nomake tests -static-runtime -opengl desktop -force-debug-info -optimize-size -no-pch -make-tool jom -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype
    

    Configuration Output:
    Full: https://pastebin.com/6Ph8t6Lv

    //...
    Qt is now configured for building. Just run 'cmake --build . --parallel'
    
    Once everything is built, you must run 'cmake --install .'
    Qt will be installed into 'C:/B'
    
    To configure and build other Qt modules, you can use the following convenience script:
            C:/B/bin/qt-configure-module.bat
    
    If reconfiguration fails for some reason, try to remove 'CMakeCache.txt' from the build directory
    
    -- Configuring done
    CMake Warning in qtquickcontrols2/src/imports/nativestyle/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/nativestyle/CMakeFiles/qtquickcontrols2nativestyleplugin_resources_qtquickcontrols2nativestyleplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 177 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        __/__/__/__/qtquicktimeline/qt_Qml_QQmlNativeDebugConnectorFactory.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/basic/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/basic/CMakeFiles/qtquickcontrols2basicstyleplugin_resources_qtquickcontrols2basicstyleplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 178 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        __/__/__/__/__/qtquicktimeline/qt_Qml_QQuickProfilerAdapterFactory.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/fusion/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/fusion/CMakeFiles/qtquickcontrols2fusionstyleplugin_resources_qtquickcontrols2fusionstyleplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 181 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        __/__/__/__/__/qtquick3d/qt_Qml_QQmlNativeDebugConnectorFactory.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/fusion/impl/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/fusion/impl/CMakeFiles/qtquickcontrols2fusionstyleimplplugin_resources_qtquickcontrols2fusionstyleimplplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 194 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        __/__/__/__/__/__/qttools/qt_Qml_QTcpServerConnectionFactory.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/imagine/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/imagine/CMakeFiles/qtquickcontrols2imaginestyleplugin_resources_qtquickcontrols2imaginestyleplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 184 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        __/__/__/__/__/qttools/qt_Qml_QQmlNativeDebugServiceFactory.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/imagine/impl/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/imagine/impl/CMakeFiles/qtquickcontrols2imaginestyleimplplugin_resources_qtquickcontrols2imaginestyleimplplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 197 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        .rcc/qmlcache/qtquickcontrols2imaginestyleimplplugin_qml_files_resource_2/qmlcache_loader.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/material/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/material/CMakeFiles/qtquickcontrols2materialstyleplugin_resources_qtquickcontrols2materialstyleplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 187 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        __/__/__/__/__/qttools/qt_Qml_QQmlNativeDebugConnectorFactory.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/material/impl/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/material/impl/CMakeFiles/qtquickcontrols2materialstyleimplplugin_resources_qtquickcontrols2materialstyleimplplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 200 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        .rcc/qmlcache/qtquickcontrols2materialstyleimplplugin_qml_files_resource_2/qmlcache_loader.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/universal/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/universal/CMakeFiles/qtquickcontrols2universalstyleplugin_resources_qtquickcontrols2universalstyleplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 190 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        __/__/__/__/__/qttools/qt_Qml_QQuickProfilerAdapterFactory.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/universal/impl/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/universal/impl/CMakeFiles/qtquickcontrols2universalstyleimplplugin_resources_qtquickcontrols2universalstyleimplplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 203 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        .rcc/qmlcache/qtquickcontrols2universalstyleimplplugin_qml_files_resource_2/qmlcache_loader.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    CMake Warning in qtquickcontrols2/src/imports/controls/windows/CMakeLists.txt:
      The object file directory
    
        C:/Q/qtquickcontrols2/src/imports/controls/windows/CMakeFiles/qtquickcontrols2windowsstyleplugin_resources_qtquickcontrols2windowsstyleplugin_qml_files_resource_2.dir/${CONFIGURATION}/
    
      has 184 characters.  The maximum full path to an object file is 250
      characters (see CMAKE_OBJECT_PATH_MAX).  Object file
    
        __/__/__/__/__/qttools/qt_Qml_QQmlNativeDebugConnectorFactory.cpp.obj
    
      cannot be safely placed under this directory.  The build may not work
      correctly.
    
    
    -- Generating done
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        BUILD_webengine
        INPUT_make_tool
    
    
    -- Build files have been written to: C:/Q
    

    (Seems like I'm getting tools whether I like it or not)

    As you can see there are issues with resultant paths being too long. I most likely don't need QtQuick in this build so I could just turn it off, but since -nomake-tools seems to be a placeholder at this point for Qt6 I can't get around the problematic files that come from the qttools directory.

    If I ignore all this and attempt to build anyway with:

    cmake --build . --parallel 10
    

    I get:

    ninja: error: Stat(qtquickcontrols2/src/imports/controls/imagine/impl/CMakeFiles/qtquickcontrols2imaginestyleimplplugin_resources_qtquickcontrols2imaginestyleimplplugin_qml_files_resource_2.dir/Debug/.rcc/qmlcache/qtquickcontrols2imaginestyleimplplugin_qml_files_resource_2/qmlcache_loader.cpp.obj): Filename longer than 260 characters
    

    a 283 character long path when including the drive letter and parent folder, so CMake definitely isn't lying.

    Not sure what I can do about this since I don't control the source directory layout, but at the same time I'm don't exactly believe that I'm not somehow doing something wrong and that this distribution is just simply unbuildable.

    I could try shortening the file names and using Notepad++ to replace all references to the original with the shorter name, but that seems... janky to say the least.


  • Moderators

    I think this will be fixed in Qt 6.0.1: QTBUG-88581



  • @kkoehne
    Ah I see, so it is an issue with the source tree, but in particular with MSVC static builds.

    I guess I'll also playing around with a workaround for now as I'd like to make use of changes I sent upstream for 6 but I'm sure 6.0.1 shouldn't be too far behind since this is a little more than a minor issue.

    Thanks.



  • @oblivioncth I can confirm that this was fixed in 6.0.1